{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using backend: pytorch\n",
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/dgl/base.py:45: DGLWarning: Detected an old version of PyTorch. Suggest using torch>=1.5.0 for the best experience.\n",
      "  return warnings.warn(message, category=category, stacklevel=1)\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "sys.path.append(\"../../\")\n",
    "sys.path.append(\"../\")\n",
    "from Dataloader.dataloader_utils import Sample_data, Merge_data, Lemma_Factory\n",
    "from Dataloader.twitterloader import TwitterSet, BiGCNTwitterSet\n",
    "from SentModel.Sent2Vec import TFIDFBasedVec, W2VRDMVec\n",
    "from PropModel.GraphPropagation import BiGCN\n",
    "from RumdetecFramework.GraphRumorDect import BiGCNRumorDetec\n",
    "from RumdetecFramework.BaseRumorFramework import RumorDetection\n",
    "from RumdetecFramework.InstanceReweighting import MetaEvaluator, WeightedAcc\n",
    "from torch.utils.data import DataLoader\n",
    "from sklearn.feature_extraction.text import TfidfVectorizer\n",
    "from sklearn.metrics import accuracy_score, precision_score, \\\n",
    "            recall_score, f1_score,precision_recall_fscore_support\n",
    "import pickle\n",
    "import torch\n",
    "import torch.nn as nn\n",
    "import random\n",
    "import os\n",
    "import fitlog\n",
    "\n",
    "def pred_Logits(model:RumorDetection, data, idxs=None, batch_size=20):\n",
    "    preds = []\n",
    "    if idxs is None:\n",
    "        idxs = list(range(len(data)))\n",
    "    with torch.no_grad():\n",
    "        for i in range(0, len(idxs), batch_size):\n",
    "            batch_idxs = idxs[i:min(len(idxs), i+batch_size)]\n",
    "            batch = data.collate_raw_batch([data[idx] for idx in batch_idxs])\n",
    "            pred = model.forward(batch)\n",
    "            preds.append(pred)\n",
    "    pred_tensor = torch.cat(preds)\n",
    "    return pred_tensor\n",
    "\n",
    "def prediction(model:RumorDetection, data, idxs=None, batch_size=20):\n",
    "    pred_tensor = pred_Logits(model, data, idxs, batch_size)\n",
    "    vals, idxs = pred_tensor.sort(dim=1)\n",
    "    return idxs[:, 1], vals[:, 1]\n",
    "\n",
    "def expandPseaudoSet(model1, model2, unlabeled, skip_idxs=None, threshold=0.95, max_cnt=50):\n",
    "    if skip_idxs is None:\n",
    "        c_idxs = list(range(len(unlabeled_set)))\n",
    "    else:\n",
    "        c_idxs = list(set(range(len(unlabeled_set))) - set(skip_idxs))\n",
    "    pred_1, conf_1 = prediction(model1, unlabeled, c_idxs)\n",
    "    pred_2, conf_2 = prediction(model2, unlabeled, c_idxs)\n",
    "    pred_eq = (pred_1 - pred_2).abs().__eq__(0)\n",
    "    valid_conf_1 = conf_1.__gt__(threshold) & pred_eq\n",
    "    valid_conf_2 = conf_2.__gt__(threshold) & valid_conf_1\n",
    "    expand_idxs = torch.tensor(c_idxs, device=valid_conf_2.device)[valid_conf_2]\n",
    "    if len(expand_idxs) > max_cnt:\n",
    "        conf_f1 = 2*conf_2*conf_1/(conf_2+conf_1)\n",
    "        sort_idxs = conf_f1[valid_conf_2].argsort()[-max_cnt:]\n",
    "        expand_idxs = expand_idxs[sort_idxs].tolist()\n",
    "    else:\n",
    "        expand_idxs = expand_idxs.tolist()\n",
    "    return expand_idxs\n",
    "\n",
    "def acc_P_R_F1(y_true, y_pred):\n",
    "    return accuracy_score(y_true, y_pred.cpu()), \\\n",
    "                precision_recall_fscore_support(y_true, y_pred.cpu())\n",
    "\n",
    "def Perf(model:RumorDetection, data, label, idxs=None, batch_size=20):\n",
    "    y_pred, _ = prediction(model, data, idxs=idxs, batch_size=batch_size)\n",
    "    y_true = label[idxs] if idxs is not None else label\n",
    "    return acc_P_R_F1(y_true, y_pred)\n",
    "\n",
    "def WeakLabeling(model:RumorDetection, data, pseaudo_idxs=[], batch_size=20):\n",
    "    c_idxs = list(set(range(len(data))) - set(pseaudo_idxs))\n",
    "    pred_tensor = pred_Logits(model, data, idxs=c_idxs, batch_size=batch_size)\n",
    "    confs, preds = pred_tensor.sort(dim=1)\n",
    "    weak_label = (pred_tensor > 0.5).long().tolist()\n",
    "    for i, idx in enumerate(c_idxs):\n",
    "        data.data_y[idx] = weak_label[i]\n",
    "    entrophy = torch.zeros([len(data)], device=model.device)\n",
    "    entrophy[c_idxs] = (confs.log().abs() * confs).sum(dim=1)\n",
    "    return entrophy, preds[:, 1], confs[:, 1]\n",
    "\n",
    "def obtain_model(tfidf_vec):\n",
    "    lvec = TFIDFBasedVec(tfidf_vec, 20, embedding_size=300,\n",
    "                         w2v_dir=\"../../saved/glove_en/\", emb_update=True)\n",
    "    prop = BiGCN(300, 256)\n",
    "    cls = nn.Linear(1024, 2)\n",
    "    model = BiGCNRumorDetec(lvec, prop, cls, batch_size=20, grad_accum_cnt=1)\n",
    "    return model\n",
    "\n",
    "def obtain_Domain_set(fs_prefix, od_prefix, nd_prefix):\n",
    "    fs_set = TwitterSet()\n",
    "    fs_set.load_data_fast(data_prefix=fs_prefix)\n",
    "    od_set = TwitterSet()\n",
    "    od_set.load_data_fast(data_prefix=od_prefix)\n",
    "    nd_set = TwitterSet()\n",
    "    nd_set.load_data_fast(data_prefix=nd_prefix)\n",
    "    return fs_set, od_set, nd_set\n",
    "\n",
    "def Convert_2_BiGCNFormat(data):\n",
    "    new_data = BiGCNTwitterSet()\n",
    "    new_data.data = data.data\n",
    "    new_data.data_ID = data.data_ID\n",
    "    new_data.data_len = data.data_len\n",
    "    new_data.data_y = data.data_y\n",
    "    return new_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "class MetaSelfTrainer(MetaEvaluator):\n",
    "    def __init__(self, model: RumorDetection, weak_set, few_shot_set,\n",
    "                weak_set_label, exp_idxs=[], weak_set_weights=None, convey_fn=None,\n",
    "                 lr4model=2e-2, scale_lr4model=1e-3, coeff4expandset=1.0,\n",
    "                batch_size=5):\n",
    "        super(MetaSelfTrainer, self).__init__(model, weak_set, few_shot_set,\n",
    "                                               weak_set_label, exp_idxs, weak_set_weights,\n",
    "                                               convey_fn, lr4model, scale_lr4model, coeff4expandset,\n",
    "                                               batch_size)\n",
    "        self.expand_batch = []\n",
    "\n",
    "    def LogSelectionInfo(self, e_arr, valid_idxs=None):\n",
    "        indices = torch.arange(len(self.weak_set))\n",
    "        print(\">>>>>>>MetaEvaluate Message>>>>>>>>>>>>>>>\")\n",
    "        pos_indices = valid_idxs if valid_idxs is not None else indices[self.weak_set_weights.__gt__(0.0)]\n",
    "        labels, preds = self.weak_set_label[indices], torch.tensor(self.weak_set.data_y)[\n",
    "            indices].argmax(dim=1)\n",
    "        print(len(indices))\n",
    "        print(len(pos_indices))\n",
    "        print(e_arr.mean(), e_arr[pos_indices].mean())\n",
    "        print(accuracy_score(labels, preds), accuracy_score(labels[pos_indices], preds[pos_indices]))\n",
    "        print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "        print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "        print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))\n",
    "        print(\"<<<<<<<<<<<<<<<<<MetaEvaluate Message<<<<<<<<<<<<\")\n",
    "\n",
    "    def balancedTrainingIter(self, valid_idxs=None):\n",
    "        labels = torch.tensor(self.weak_set.data_y).argmax(dim=1)[valid_idxs]\n",
    "        valid_idxs = valid_idxs if isinstance(valid_idxs, torch.Tensor) else torch.tensor(valid_idxs)\n",
    "        pos_idxs = valid_idxs[labels.__eq__(1)].tolist()\n",
    "        neg_idxs = valid_idxs[labels.__eq__(0)].tolist()\n",
    "        if len(pos_idxs) > len(neg_idxs):\n",
    "            max_size = len(pos_idxs)\n",
    "            neg_idxs = neg_idxs*(len(pos_idxs)//len(neg_idxs)) + \\\n",
    "                            random.sample(neg_idxs, len(pos_idxs)%len(neg_idxs))\n",
    "        else:\n",
    "            max_size = len(neg_idxs)\n",
    "            pos_idxs = pos_idxs * (len(neg_idxs) // len(pos_idxs)) + \\\n",
    "                            random.sample(pos_idxs, len(neg_idxs) % len(pos_idxs))\n",
    "        for i in range(0, max_size, self.batch_size//2):\n",
    "            training_idxs = pos_idxs[i:min(max_size, i+self.batch_size//2)] + \\\n",
    "                                neg_idxs[i:min(max_size, i + self.batch_size // 2)]\n",
    "            yield self.weak_set.collate_raw_batch([self.weak_set[j] for j in training_idxs])\n",
    "\n",
    "    def BalancedSelections(self):\n",
    "        indices = torch.arange(self.weak_set_size)\n",
    "        weak_labels = torch.tensor(self.weak_set.data_y)[indices].argmax(dim=1)\n",
    "\n",
    "        init_ratio = weak_labels.sum() * 1.0 / len(weak_labels)\n",
    "        print(\">>>>>>>>>>>>>>>init ratio:\", init_ratio)\n",
    "        valid_indices = indices[self.weak_set_weights.__gt__(0.0)]\n",
    "        # *************************balance the training data***************************#\n",
    "        valid_labels = weak_labels[valid_indices]\n",
    "        ratio = valid_labels.sum() * 1.0 / len(valid_indices)\n",
    "        print(\">>>>>>>>>>>>>>>ratio:\", ratio)\n",
    "        if ratio >= 0.9:\n",
    "            if init_ratio < 0.5:\n",
    "                valid_indices = self.weak_set_weights.argsort()[-len(indices)//2:]\n",
    "            else:\n",
    "                negs = indices[weak_labels.__eq__(0)]\n",
    "                idxs = self.weak_set_weights[negs].argsort()[-len(negs) // 3:]\n",
    "                neg_exp = negs[idxs]\n",
    "                valid_indices = torch.cat([valid_indices, neg_exp])\n",
    "            valid_labels = weak_labels[valid_indices]\n",
    "            ratio = valid_labels.sum() * 1.0 / len(valid_indices)\n",
    "        elif ratio <= 0.1:\n",
    "            if init_ratio > 0.5:\n",
    "                valid_indices = self.weak_set_weights.argsort()[-len(indices) // 2:]\n",
    "            else:\n",
    "                pos = indices[weak_labels.__eq__(1)]\n",
    "                idxs = self.weak_set_weights[pos].argsort()[-len(pos) // 3:]\n",
    "                pos_exp = pos[idxs]\n",
    "                valid_indices = torch.cat([valid_indices, pos_exp])\n",
    "            valid_labels = weak_labels[valid_indices]\n",
    "            ratio = valid_labels.sum() * 1.0 / len(valid_indices)\n",
    "        print(\">>>>>>>>> modified ratio:\", ratio)\n",
    "        return valid_indices\n",
    "\n",
    "    def ModelTrain(self, max_epoch, valid_indices):\n",
    "        for epoch in range(max_epoch):\n",
    "            start = 0\n",
    "            sum_loss = 0.\n",
    "            for batch in self.balancedTrainingIter(valid_indices):\n",
    "                loss = self.InnerLoss(batch, self.model)\n",
    "                cost = torch.mean(loss)\n",
    "                self.model.zero_grad()\n",
    "                self.model_optim.zero_grad()\n",
    "                cost.backward()\n",
    "                self.model_optim.step()\n",
    "                torch.cuda.empty_cache()\n",
    "                print('####Model Update (%3d | %3d) ####, loss = %6.8f' % (\n",
    "                    start, len(valid_indices), loss.data.mean()\n",
    "                ))\n",
    "                sum_loss += cost.data\n",
    "                start += self.batch_size\n",
    "            mean_loss = (sum_loss * 1.0) / ((len(valid_indices) // self.batch_size) + 1)\n",
    "            print(\"mean loss:\", mean_loss)\n",
    "            if mean_loss < 0.2:  # early stop\n",
    "                break\n",
    "\n",
    "    def Training(self, entrophys, max_epoch=1, batch_size=32, max_meta_steps=10,\n",
    "                 lr4weights=0.1, meta_lr4model=1e-1,\n",
    "                 meta_scale_lr4model=5e-3):\n",
    "        tmp = (self.lr4model, self.scale_lr4model)\n",
    "        self.lr4model, self.scale_lr4model = meta_lr4model, meta_scale_lr4model\n",
    "        exp_idxs = self.Evaluate(max_epochs=1, max_meta_steps=max_meta_steps, lr4weights=lr4weights)  # ferguson 上是0.1, sydney上是0.05\n",
    "        self.lr4model, self.scale_lr4model = tmp[0], tmp[1]\n",
    "        self.LogSelectionInfo(entrophys)\n",
    "        valid_indices = self.BalancedSelections() # select a balanced set based on the weak_set_weights\n",
    "        self.batch_size = batch_size\n",
    "        self.ModelTrain(max_epoch, valid_indices)\n",
    "        return exp_idxs, torch.arange(self.weak_set_size)[self.weak_set_weights.__gt__(0.0)].tolist()\n",
    "\n",
    "    def BalancedTraining(self, entrophys, max_epoch=1, batch_size=32, max_meta_steps=10,\n",
    "        lr4weights=0.1, meta_lr4model=1e-1, meta_scale_lr4model=5e-3, pseaudo_idxs=[]):\n",
    "        tmp = (self.lr4model, self.scale_lr4model)\n",
    "        self.lr4model, self.scale_lr4model = meta_lr4model, meta_scale_lr4model\n",
    "        exp_idxs, valid_idxs = self.ValidIndicesOut(max_epochs=1, max_meta_steps=max_meta_steps,\n",
    "                                            lr4weights=lr4weights, pseaudo_idxs=pseaudo_idxs) # ferguson 上是0.1, sydney上是0.05\n",
    "        self.lr4model, self.scale_lr4model = tmp[0], tmp[1]\n",
    "        self.LogSelectionInfo(entrophys, valid_idxs=valid_idxs)\n",
    "        self.batch_size = batch_size\n",
    "        train_idxs = valid_idxs + pseaudo_idxs\n",
    "        self.ModelTrain(max_epoch, train_idxs)\n",
    "        return exp_idxs, valid_idxs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "OOV Count: 9570\n",
      "OOV Ratio: 0.25373173900363233\n",
      "OOV Count: 9570\n",
      "OOV Ratio: 0.25373173900363233\n"
     ]
    }
   ],
   "source": [
    "BiGCN1_Paths = [\"../../saved/TFIDF_BiGCN_charliehebdo_0.81.pkl\",\n",
    "               \"../../saved/TFIDF_BiGCN_ferguson_0.68.pkl\",\n",
    "               \"../../saved/TFIDF_BiGCN_germanwings-crash_0.70.pkl\",\n",
    "               \"../../saved/TFIDF_BiGCN_ottawashooting_0.68.pkl\",\n",
    "               \"../../saved/TFIDF_BiGCN_sydneysiege_0.67.pkl\"\n",
    "               ]\n",
    "\n",
    "BiGCN2_Paths = [\"../../saved/TFIDF_BiGCN_charliehebdo_0.80.pkl\",\n",
    "               \"../../saved/TFIDF_BiGCN_ferguson_0.71.pkl\",\n",
    "               \"../../saved/TFIDF_BiGCN_germanwings-crash_0.68.pkl\",\n",
    "               \"../../saved/TFIDF_BiGCN_ottawashooting_0.70.pkl\",\n",
    "               \"../../saved/TFIDF_BiGCN_sydneysiege_0.66.pkl\"\n",
    "               ]\n",
    "\n",
    "Tf_Idf_twitter_file = \"../../saved/TfIdf_twitter.pkl\"\n",
    "if os.path.exists(Tf_Idf_twitter_file):\n",
    "    with open(Tf_Idf_twitter_file, \"rb\") as fr:\n",
    "        tv = pickle.load(fr)\n",
    "else:\n",
    "    i = 1\n",
    "    few_shot_set, old_domain, new_domain = obtain_Domain_set(\"../../data/twitter_fs%d\" % i,\n",
    "                                                            \"../../data/twitter_od%d\" % i,\n",
    "                                                            \"../../data/twitter_nd%d\" % i)\n",
    "    lemma = Lemma_Factory()\n",
    "    corpus = [\" \".join(lemma(txt)) for data in [few_shot_set, old_domain, new_domain]\n",
    "                                    for ID in data.data_ID for txt in data.data[ID]['text']]\n",
    "    tv = TfidfVectorizer(use_idf=True, smooth_idf=True, norm=None)\n",
    "    _ = tv.fit_transform(corpus)\n",
    "    with open(Tf_Idf_twitter_file, \"wb\") as fw:\n",
    "        pickle.dump(tv, fw, protocol=pickle.HIGHEST_PROTOCOL)\n",
    "\n",
    "\n",
    "model1 = obtain_model(tv)\n",
    "model2 = obtain_model(tv)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "load len:  100\n",
      "load len:  3539\n",
      "load len:  972\n"
     ]
    }
   ],
   "source": [
    "i = 4\n",
    "# old_domain, new_domain = obtain_Domain_set(\"../../data/twitter_tr%d\"%i,\n",
    "#                                            \"../../data/twitter_dev%d\"%i,\n",
    "#                                            \"../../data/twitter_te%d\"%i)\n",
    "few_shot_set, old_domain, new_domain = obtain_Domain_set(\n",
    "                                           \"../../data/twitter_fs%d\"%i,\n",
    "                                           \"../../data/twitter_od%d\"%i,\n",
    "                                           \"../../data/twitter_nd%d\"%i)\n",
    "\n",
    "new_domain_name = new_domain.data[new_domain.data_ID[0]]['event']\n",
    "new_domain_label = torch.tensor(new_domain.data_y).argmax(dim=1)\n",
    "\n",
    "model1.load_model(BiGCN1_Paths[i])\n",
    "model2.load_model(BiGCN2_Paths[i])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "Bi_new_domain = Convert_2_BiGCNFormat(new_domain)\n",
    "Bi_new_domain_loader = DataLoader(Bi_new_domain, batch_size=20, shuffle=False,\n",
    "                               collate_fn=Bi_new_domain.collate_raw_batch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "rst_model1 = model1.valid(Bi_new_domain_loader, all_metrics=True)\n",
    "print(\"Original Performance of model1_%s:\"%new_domain_name, rst_model1)\n",
    "rst_model2 = model2.valid(Bi_new_domain_loader, all_metrics=True)\n",
    "print(\"Original Performance of model2_%s:\"%new_domain_name, rst_model2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time gap: 23.75288152694702\n"
     ]
    }
   ],
   "source": [
    "t0 = time.time()\n",
    "Perf(model2, Bi_new_domain, new_domain_label)\n",
    "print(\"time gap:\", time.time()-t0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time gap: 5.571458339691162\n"
     ]
    }
   ],
   "source": [
    "t0 = time.time()\n",
    "Perf(model1, Bi_new_domain, new_domain_label)\n",
    "print(\"time gap:\", time.time()-t0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "pseaudo_idxs = []\n",
    "expand_set_idxs = []\n",
    "unlabeled_set = Convert_2_BiGCNFormat(new_domain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "    entrophy, preds, logits = WeakLabeling(model2, unlabeled_set, pseaudo_idxs=pseaudo_idxs+expand_set_idxs)\n",
    "    idxs = expandPseaudoSet(model1, model2, unlabeled_set, pseaudo_idxs+expand_set_idxs, threshold=0.95)\n",
    "    pseaudo_idxs.extend(idxs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "    IR_weighting = MetaSelfTrainer(model1, unlabeled_set, Convert_2_BiGCNFormat(few_shot_set),\n",
    "                                   new_domain_label, exp_idxs=expand_set_idxs, convey_fn=None, lr4model=5e-2,\n",
    "                                    scale_lr4model=4e-2, batch_size=20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0., device='cuda:1'), 0.4, 0.5)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.\n",
      "  warnings.warn(warning.format(ret))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot   0 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57140744/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.56250566/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0003, device='cuda:1'), 0.3, 0.5)\n",
      "=====> Optimized weights: tensor([-0.3002, -0.3005, -0.3005, -0.3004,  0.2990, -0.2999, -0.3004, -0.3005,\n",
      "        -0.3004, -0.3002, -0.3003, -0.3003, -0.3002, -0.3005, -0.2999,  0.2991,\n",
      "        -0.3002,  0.2986,  0.2988, -0.3001], device='cuda:1')\n",
      "=====> init acc: (tensor(0.7000, device='cuda:1'), 0.8, 0.85)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57113993/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.56206721/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2015, device='cuda:1'), 0.8, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.2983,  0.2984, -0.3001,  0.2985, -0.2996, -0.3003,  0.2984,  0.2988,\n",
      "        -0.3003, -0.3003, -0.3002, -0.2999, -0.3004, -0.2999, -0.3000, -0.2999,\n",
      "        -0.2993, -0.3001, -0.2998, -0.2998], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.7, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57155633/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.56279647/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0990, device='cuda:1'), 0.8, 1.0)\n",
      "=====> Optimized weights: tensor([-0.2999, -0.3003, -0.3000,  0.2994, -0.3003, -0.3005, -0.3000, -0.3001,\n",
      "        -0.3000,  0.2996, -0.3002, -0.3004, -0.3000, -0.3005,  0.2993,  0.2996,\n",
      "         0.2968, -0.3000,  0.2992, -0.3004], device='cuda:1')\n",
      "=====> init acc: (tensor(0.1000, device='cuda:1'), 0.8, 0.55)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.56705081/0.7300000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.55503809/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2001, device='cuda:1'), 0.7, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3005, -0.3005, -0.3005, -0.3005, -0.3005, -0.3005, -0.3005,  0.2999,\n",
      "         0.2999, -0.3001,  0.2992,  0.2995, -0.3004, -0.3004,  0.2984,  0.2994,\n",
      "         0.2999,  0.2992,  0.2993, -0.3005], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.5, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.57187486/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.56340075/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.1007, device='cuda:1'), 0.6, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3003,  0.2987, -0.3001, -0.3003,  0.2996, -0.2999,  0.2992, -0.3001,\n",
      "        -0.3003,  0.2988,  0.2984,  0.2982,  0.2993, -0.3005, -0.2999, -0.3000,\n",
      "         0.2994, -0.3002,  0.2991, -0.3000], device='cuda:1')\n",
      "=====> init acc: (tensor(0.1000, device='cuda:1'), 0.5, 0.55)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.56287634/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.54847807/0.7500000\n",
      "=====> Optimized acc: (tensor(0.0992, device='cuda:1'), 0.6, 0.6)\n",
      "=====> Optimized weights: tensor([ 0.2998,  0.2979, -0.3004, -0.3005,  0.2987, -0.3004,  0.2996, -0.3005,\n",
      "        -0.3001,  0.2988,  0.2996, -0.3004, -0.3001,  0.2991, -0.3005,  0.2992,\n",
      "        -0.3002,  0.2998, -0.3005,  0.2991], device='cuda:1')\n",
      "=====> init acc: (tensor(0.1000, device='cuda:1'), 0.5, 0.55)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.56766975/0.7300000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.55607581/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0999, device='cuda:1'), 0.5, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3001, -0.3003,  0.2990,  0.2979, -0.3002, -0.3005,  0.2987, -0.3004,\n",
      "         0.2985, -0.3004, -0.3005, -0.3001,  0.2980, -0.3003, -0.3005, -0.3005,\n",
      "        -0.3005, -0.3005,  0.2992, -0.3005], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.5, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.57258081/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.56461710/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2005, device='cuda:1'), 0.5, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3004, -0.3001, -0.3004, -0.3005, -0.3002, -0.3003, -0.3004, -0.3004,\n",
      "        -0.3003, -0.3001,  0.2994, -0.3003, -0.3005, -0.3002, -0.3004, -0.3003,\n",
      "        -0.3005, -0.3001, -0.3004,  0.2995], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.7, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.57127780/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.56231940/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.4013, device='cuda:1'), 0.7, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3005, -0.2999,  0.2990, -0.3001, -0.2999,  0.2989, -0.3001,  0.2994,\n",
      "        -0.3000, -0.3001, -0.3004,  0.2979, -0.3001, -0.2999,  0.2990, -0.3003,\n",
      "         0.2989, -0.3001, -0.3002, -0.3004], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.8, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.57149434/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.56267619/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.3001, device='cuda:1'), 0.6, 0.5)\n",
      "=====> Optimized weights: tensor([-0.3004, -0.3005, -0.3003, -0.3003, -0.3005, -0.3003, -0.3002,  0.2995,\n",
      "         0.2998,  0.2987,  0.2988, -0.3005, -0.3004, -0.3004, -0.3004,  0.3000,\n",
      "        -0.3003, -0.3005, -0.3002,  0.2995], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.6, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.57057333/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.56109935/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0004, device='cuda:1'), 0.7, 0.75)\n",
      "=====> Optimized weights: tensor([-0.3002, -0.3001, -0.3004,  0.2991, -0.3001, -0.2999, -0.2999, -0.3000,\n",
      "         0.2985, -0.3003, -0.3001, -0.2998, -0.3004, -0.2999, -0.3003, -0.3004,\n",
      "         0.2985, -0.2999,  0.2993, -0.2998], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.6, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.56747836/0.7300000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.55577546/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0014, device='cuda:1'), 0.8, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.3000,  0.2984,  0.2993, -0.3004, -0.3005, -0.3005,  0.2991, -0.3000,\n",
      "        -0.3003, -0.3005,  0.2988, -0.3002,  0.2998, -0.3005, -0.3004, -0.3005,\n",
      "        -0.3004,  0.2983, -0.3005,  0.2994], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.9, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.56923085/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.55875146/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2005, device='cuda:1'), 0.7, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3004, -0.3002, -0.3004,  0.2996,  0.2989, -0.3004, -0.3005, -0.3005,\n",
      "         0.2997, -0.3005,  0.2999, -0.3005,  0.2995, -0.3003, -0.3004,  0.2997,\n",
      "         0.2984,  0.2995, -0.3005,  0.2997], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.5, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.57014227/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.56032318/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2010, device='cuda:1'), 0.6, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3005,  0.2986, -0.3001, -0.3005,  0.2994, -0.3002, -0.3004, -0.3005,\n",
      "         0.2980, -0.3003, -0.3003,  0.2981, -0.3003,  0.2987, -0.3004, -0.3004,\n",
      "        -0.3000,  0.2990, -0.3003, -0.3004], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.6, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.56793261/0.7300000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.55653000/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0997, device='cuda:1'), 0.8, 0.75)\n",
      "=====> Optimized weights: tensor([-0.3004, -0.3002, -0.3000, -0.3003, -0.3000, -0.3002, -0.3004,  0.2997,\n",
      "         0.2989,  0.2991, -0.3005, -0.3004, -0.3003,  0.2972,  0.2969,  0.2991,\n",
      "        -0.3002,  0.2992,  0.2990, -0.3002], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.7, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.57363951/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.56655359/0.7300000\n",
      "=====> Optimized acc: (tensor(-0.2007, device='cuda:1'), 0.7, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3001, -0.2999, -0.3001, -0.3002, -0.3000, -0.3003, -0.3004, -0.3005,\n",
      "         0.2995, -0.3001, -0.3003,  0.2993, -0.3004, -0.3003,  0.2994, -0.3003,\n",
      "        -0.3003, -0.3003, -0.3003, -0.3003], device='cuda:1')\n",
      "=====> init acc: (tensor(0.1000, device='cuda:1'), 0.7, 0.55)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.56621140/0.7300000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.55369562/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0997, device='cuda:1'), 0.6, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3004,  0.2980, -0.3005,  0.2988, -0.2999, -0.3002, -0.2998,  0.2986,\n",
      "        -0.3003, -0.3005, -0.3001, -0.3005, -0.3005,  0.2979, -0.3002, -0.3003,\n",
      "        -0.3002,  0.2989,  0.2982, -0.3005], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.7, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.57202590/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.56362778/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0013, device='cuda:1'), 0.8, 0.875)\n",
      "=====> Optimized weights: tensor([-0.3003, -0.3004,  0.2989, -0.3003,  0.2995, -0.3002,  0.2994, -0.3003,\n",
      "         0.2988,  0.2993, -0.3001, -0.3004,  0.2988, -0.2999, -0.3005,  0.2994,\n",
      "        -0.3002, -0.2999, -0.3003,  0.2988], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.7, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.57085806/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.56154561/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0009, device='cuda:1'), 0.8, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3005, -0.3004, -0.3004,  0.2994,  0.2991, -0.3001, -0.3005, -0.3003,\n",
      "         0.2990, -0.3003, -0.3001, -0.3003, -0.3000, -0.3000,  0.2992, -0.3005,\n",
      "        -0.3004,  0.2998, -0.3005, -0.3004], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.6, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.56756914/0.7300000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.55600441/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.3010, device='cuda:1'), 0.6, 0.75)\n",
      "=====> Optimized weights: tensor([-0.3002,  0.2978, -0.3002, -0.3004, -0.3004, -0.3005, -0.3003,  0.2995,\n",
      "        -0.3000, -0.3004, -0.3004, -0.3003, -0.3005, -0.3004,  0.2995, -0.3002,\n",
      "        -0.3005, -0.3004,  0.2994, -0.3003], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.9, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.56936270/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.55898964/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0006, device='cuda:1'), 0.9, 0.875)\n",
      "=====> Optimized weights: tensor([ 0.3002,  0.2997, -0.3001, -0.3005, -0.3004,  0.2997, -0.3005, -0.3005,\n",
      "        -0.3004,  0.2998, -0.3005,  0.2998, -0.3005,  0.2995,  0.2999, -0.3004,\n",
      "        -0.3004, -0.3002, -0.3005,  0.2999], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.6, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.56908530/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.55855387/0.7400000\n",
      "=====> Optimized acc: (tensor(0.3988, device='cuda:1'), 0.8, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3000, -0.3001,  0.2990,  0.2980,  0.2991, -0.3004,  0.2991, -0.3001,\n",
      "        -0.3004,  0.2980, -0.3003, -0.3004, -0.3000, -0.3004, -0.3003, -0.3001,\n",
      "         0.2974,  0.2994, -0.3003, -0.3000], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.9, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.57164019/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.56293654/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2001, device='cuda:1'), 0.7, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3002, -0.3005, -0.3000, -0.3003, -0.3002, -0.3001, -0.3002, -0.3003,\n",
      "        -0.3001, -0.3001, -0.3004, -0.3005, -0.3001, -0.3003,  0.2993, -0.3002,\n",
      "        -0.3001, -0.3000, -0.3001, -0.3005], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.7, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.57057863/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.56105345/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.1000, device='cuda:1'), 0.6, 0.6)\n",
      "=====> Optimized weights: tensor([-0.3002, -0.3000, -0.3002, -0.3003, -0.3004, -0.3004, -0.3001, -0.3002,\n",
      "        -0.3003, -0.3001,  0.2994, -0.3004, -0.3002,  0.2984, -0.3005,  0.2996,\n",
      "         0.2993,  0.2995, -0.3000, -0.3004], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(-0.1000, device='cuda:1'), 0.5, 0.45)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.57359624/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.56647605/0.7300000\n",
      "=====> Optimized acc: (tensor(0.1000, device='cuda:1'), 0.4, 0.5)\n",
      "=====> Optimized weights: tensor([-0.3001, -0.3001, -0.3000, -0.3001,  0.2990, -0.3001, -0.3000,  0.2995,\n",
      "        -0.3001, -0.3001, -0.3004, -0.3001,  0.2982, -0.3001,  0.2985, -0.3000,\n",
      "        -0.3003, -0.3003, -0.3001, -0.3001], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.7, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.56704360/0.7300000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.55502319/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0997, device='cuda:1'), 0.6, 0.8)\n",
      "=====> Optimized weights: tensor([-0.3003, -0.3001, -0.3002, -0.3002,  0.2989, -0.3004, -0.3005,  0.2978,\n",
      "        -0.2997, -0.3004, -0.2997, -0.3002,  0.2985, -0.2998, -0.3001, -0.2995,\n",
      "         0.2962, -0.3001,  0.2985, -0.3002], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.57064855/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.56119418/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0992, device='cuda:1'), 0.7, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.3004, -0.3004, -0.3001,  0.2987,  0.2994,  0.2994, -0.3001,  0.2995,\n",
      "        -0.3001, -0.3003, -0.3001, -0.3002,  0.2994,  0.2992, -0.3002, -0.3003,\n",
      "         0.2992, -0.3003, -0.3005, -0.3000], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.7, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.56997138/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.56002653/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1989, device='cuda:1'), 0.9, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3002, -0.3004, -0.3004, -0.3005, -0.3003,  0.2970, -0.3005, -0.3004,\n",
      "         0.2999, -0.3005, -0.3005, -0.3003,  0.2998,  0.2991,  0.2994, -0.3004,\n",
      "         0.2999, -0.3005,  0.2996, -0.3002], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.56720895/0.7300000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.55528784/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0982, device='cuda:1'), 0.6, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3003, -0.3002,  0.2990, -0.3005, -0.3004, -0.3002,  0.2978, -0.3001,\n",
      "        -0.3003, -0.3000, -0.3001, -0.2999, -0.3002,  0.2986, -0.3002,  0.2961,\n",
      "         0.2995, -0.3004, -0.2999, -0.3004], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.6, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.57260305/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.56468648/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2005, device='cuda:1'), 0.5, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3004, -0.3002,  0.2995,  0.2993, -0.3000,  0.2989, -0.3003, -0.3005,\n",
      "         0.2992,  0.2998, -0.3005, -0.3001, -0.3001, -0.3003, -0.3003, -0.3001,\n",
      "        -0.3001, -0.3004,  0.2996, -0.3003], device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1000, device='cuda:1'), 0.5, 0.45)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.56727469/0.7300000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.55544931/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1004, device='cuda:1'), 0.5, 0.5)\n",
      "=====> Optimized weights: tensor([ 0.2998,  0.2995, -0.3003, -0.3005,  0.2993, -0.3004, -0.3004, -0.3002,\n",
      "        -0.3002, -0.3004, -0.3005,  0.2991, -0.3005, -0.3005,  0.2997, -0.3003,\n",
      "        -0.3003,  0.2988, -0.3004, -0.3003], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.9, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.57043970/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.56083429/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2014, device='cuda:1'), 0.4, 0.6)\n",
      "=====> Optimized weights: tensor([-0.3005, -0.3001,  0.2993, -0.3004, -0.3005, -0.3004, -0.2999, -0.3001,\n",
      "        -0.3005,  0.2989, -0.3002, -0.3001, -0.3004,  0.2973, -0.3005,  0.2980,\n",
      "         0.2995, -0.3005, -0.2999, -0.3002], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.6, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.57132179/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.56237119/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2006, device='cuda:1'), 0.4, 0.5)\n",
      "=====> Optimized weights: tensor([ 0.2982, -0.3002, -0.3003, -0.3005,  0.2995, -0.3004,  0.2990, -0.3004,\n",
      "        -0.3004, -0.3002, -0.3005, -0.3002, -0.3005, -0.3005, -0.3003,  0.2993,\n",
      "        -0.3001, -0.3001, -0.3001, -0.3005], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.8, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.56889868/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.55817199/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1987, device='cuda:1'), 0.9, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3001, -0.3005,  0.2982, -0.3001, -0.3003,  0.2987,  0.2990, -0.3003,\n",
      "         0.2989, -0.3002, -0.3000, -0.3001,  0.2992, -0.3004,  0.2990, -0.3003,\n",
      "        -0.3001,  0.2983, -0.3003, -0.3005], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.5, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.57326937/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.56588459/0.7300000\n",
      "=====> Optimized acc: (tensor(-0.2008, device='cuda:1'), 0.7, 0.8)\n",
      "=====> Optimized weights: tensor([ 0.2994, -0.3004,  0.2994,  0.2995, -0.3000, -0.2999, -0.3003, -0.3004,\n",
      "        -0.3003, -0.3002, -0.3002, -0.3002, -0.3005, -0.3003, -0.3004,  0.2998,\n",
      "        -0.3004, -0.3003,  0.2992, -0.3000], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.6, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.57086205/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.56158143/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.1014, device='cuda:1'), 0.7, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([ 0.2970, -0.3001, -0.3003,  0.2997, -0.3002,  0.2986, -0.3001,  0.2979,\n",
      "        -0.3001, -0.2999, -0.3001, -0.3005, -0.3005, -0.2998,  0.2983, -0.3002,\n",
      "        -0.3004, -0.2999,  0.2994, -0.3002], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.7000, device='cuda:1'), 0.8, 0.85)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.57525790/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.56955314/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2006, device='cuda:1'), 0.7, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.3001, -0.3002, -0.3001, -0.3004,  0.2998, -0.3001,  0.2999,  0.2997,\n",
      "        -0.3000,  0.2999,  0.2997,  0.2994, -0.3001, -0.3004,  0.2997, -0.3003,\n",
      "        -0.3000, -0.3001, -0.3003, -0.3003], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.6, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.57027829/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.56057954/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2002, device='cuda:1'), 0.5, 0.6)\n",
      "=====> Optimized weights: tensor([-0.2996, -0.3001, -0.3000, -0.2999, -0.2997, -0.3004, -0.2999, -0.2997,\n",
      "        -0.2994, -0.3003, -0.3004, -0.3003, -0.2999, -0.3000, -0.3001, -0.3002,\n",
      "        -0.3000, -0.3000, -0.2998, -0.3003], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.56810880/0.7300000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.55681121/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0011, device='cuda:1'), 0.7, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([ 0.2998, -0.3003,  0.2991, -0.3003, -0.3004, -0.3000, -0.3005,  0.2995,\n",
      "         0.2979, -0.3005, -0.3005, -0.3003, -0.3001, -0.3004, -0.3005,  0.2986,\n",
      "        -0.3004,  0.2999, -0.3003, -0.3004], device='cuda:1')\n",
      "=====> init acc: (tensor(0., device='cuda:1'), 0.4, 0.5)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.56901240/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.55836278/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0996, device='cuda:1'), 0.6, 0.5714285714285714)\n",
      "=====> Optimized weights: tensor([-0.3000, -0.3002, -0.2999,  0.2991, -0.3000, -0.3003, -0.3004, -0.3005,\n",
      "        -0.3005, -0.3003, -0.2999, -0.3004, -0.3001,  0.2987,  0.2995,  0.2992,\n",
      "         0.2982,  0.2993, -0.3004,  0.2994], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.8, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.57111144/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.56197059/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0011, device='cuda:1'), 0.7, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.3003, -0.2999,  0.2994,  0.2995,  0.2975, -0.3004, -0.3002, -0.3002,\n",
      "        -0.3002, -0.3004, -0.3002, -0.2999,  0.2993, -0.2999, -0.3005,  0.2991,\n",
      "        -0.3002,  0.2990, -0.2999, -0.2999], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.7, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.56813741/0.7300000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.55684447/0.7400000\n",
      "=====> Optimized acc: (tensor(0.4990, device='cuda:1'), 0.8, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.2991, -0.3004, -0.3004, -0.3005,  0.2975,  0.2994, -0.3005, -0.3003,\n",
      "        -0.3004, -0.3004,  0.2997, -0.3004, -0.3005,  0.2988,  0.2994,  0.2989,\n",
      "         0.2997, -0.3004, -0.3005, -0.3005], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.56728280/0.7300000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.55551797/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.3007, device='cuda:1'), 0.7, 0.6)\n",
      "=====> Optimized weights: tensor([-0.2996, -0.3002,  0.2985, -0.3005,  0.2988, -0.2999, -0.2999, -0.3005,\n",
      "        -0.3005, -0.2999,  0.2980, -0.3005, -0.3004, -0.3001,  0.2984, -0.3005,\n",
      "        -0.3001, -0.3004, -0.3004,  0.2985], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.8, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.57047528/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.56090987/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.1005, device='cuda:1'), 0.8, 0.8)\n",
      "=====> Optimized weights: tensor([-0.3000,  0.2992, -0.3003, -0.2999, -0.2999, -0.3004, -0.3004, -0.3000,\n",
      "        -0.3003,  0.2971, -0.3001,  0.2989, -0.3003, -0.3002,  0.2987, -0.3005,\n",
      "        -0.3003, -0.2998,  0.2985, -0.3000], device='cuda:1')\n",
      "=====> init acc: (tensor(0.1000, device='cuda:1'), 0.6, 0.55)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.56808227/0.7300000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.55673140/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.1008, device='cuda:1'), 0.4, 0.5)\n",
      "=====> Optimized weights: tensor([-0.3000,  0.2981,  0.2993,  0.2978, -0.3000,  0.2983, -0.3003, -0.3001,\n",
      "        -0.3002,  0.2986, -0.2998, -0.3002,  0.2989, -0.3001,  0.2990, -0.3001,\n",
      "        -0.3004, -0.3000, -0.3004,  0.2994], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.8, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.57141459/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.56256884/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0012, device='cuda:1'), 0.8, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([ 0.2991, -0.3000, -0.3000, -0.3002, -0.3003, -0.3004, -0.3004,  0.2990,\n",
      "         0.2992, -0.2999,  0.2993, -0.3001, -0.3003, -0.2999,  0.2989,  0.2984,\n",
      "        -0.3004, -0.3004, -0.3002,  0.2980], device='cuda:1')\n",
      "=====> init acc: (tensor(0., device='cuda:1'), 0.5, 0.5)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.56682158/0.7300000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.55475467/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0997, device='cuda:1'), 0.6, 0.42857142857142855)\n",
      "=====> Optimized weights: tensor([-0.3002, -0.3005, -0.3004,  0.2986,  0.2992,  0.2994, -0.2997, -0.3003,\n",
      "        -0.3004, -0.3002, -0.3004, -0.3005, -0.3005, -0.3004, -0.3005,  0.2998,\n",
      "        -0.3005,  0.2984,  0.2997,  0.2991], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.57173449/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.56309879/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0994, device='cuda:1'), 0.9, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.3004, -0.3004, -0.3002, -0.3004, -0.3003,  0.2989,  0.2997, -0.3005,\n",
      "         0.2996, -0.3005, -0.3003, -0.3004, -0.3004, -0.3004,  0.2997,  0.2997,\n",
      "         0.2992, -0.3005, -0.3004,  0.2999], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.0002, device='cuda:1'), 0.7, 0.0)\n",
      "=====> init weights: tensor([ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,\n",
      "         0.0000,  0.0000,  0.0000,  0.0000, -0.3002, -0.3005, -0.3005, -0.3004,\n",
      "         0.2990, -0.2999, -0.3004, -0.3005], device='cuda:1')\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.57399869/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.56373715/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.55484641/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1424, device='cuda:1'), 0.8, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.3004,  0.2992,  0.2989, -0.3004,  0.2994, -0.3004,  0.2991, -0.3000,\n",
      "         0.2987, -0.3003, -0.3004, -0.3001, -0.6004, -0.6009, -0.6009, -0.6008,\n",
      "         0.5979, -0.6000, -0.6008, -0.6009], device='cuda:1')\n",
      ">>>>>>>MetaEvaluate Message>>>>>>>>>>>>>>>\n",
      "972\n",
      "382\n",
      "tensor(0.4844, device='cuda:0') tensor(0.5358, device='cuda:0')\n",
      "0.6697530864197531 0.6335078534031413\n",
      "0.7612456747404844 0.7688172043010753\n",
      "0.4661016949152542 0.5958333333333333\n",
      "0.5781865965834428 0.6713615023474178\n",
      "<<<<<<<<<<<<<<<<<MetaEvaluate Message<<<<<<<<<<<<\n",
      "####Model Update (  0 | 382) ####, loss = 0.47768945\n",
      "####Model Update ( 32 | 382) ####, loss = 0.49877107\n",
      "####Model Update ( 64 | 382) ####, loss = 0.43863687\n",
      "####Model Update ( 96 | 382) ####, loss = 0.66618258\n",
      "####Model Update (128 | 382) ####, loss = 0.62550861\n",
      "####Model Update (160 | 382) ####, loss = 0.36456877\n",
      "####Model Update (192 | 382) ####, loss = 0.49400115\n",
      "####Model Update (224 | 382) ####, loss = 0.48516166\n",
      "####Model Update (256 | 382) ####, loss = 0.59870523\n",
      "####Model Update (288 | 382) ####, loss = 0.59010386\n",
      "####Model Update (320 | 382) ####, loss = 0.53318572\n",
      "####Model Update (352 | 382) ####, loss = 0.40154380\n",
      "####Model Update (384 | 382) ####, loss = 0.31204289\n",
      "mean loss: tensor(0.5405, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.44082105\n",
      "####Model Update ( 32 | 382) ####, loss = 0.41769248\n",
      "####Model Update ( 64 | 382) ####, loss = 0.40150788\n",
      "####Model Update ( 96 | 382) ####, loss = 0.63262200\n",
      "####Model Update (128 | 382) ####, loss = 0.58963048\n",
      "####Model Update (160 | 382) ####, loss = 0.32894844\n",
      "####Model Update (192 | 382) ####, loss = 0.46210903\n",
      "####Model Update (224 | 382) ####, loss = 0.44340694\n",
      "####Model Update (256 | 382) ####, loss = 0.54519016\n",
      "####Model Update (288 | 382) ####, loss = 0.54787743\n",
      "####Model Update (320 | 382) ####, loss = 0.51189923\n",
      "####Model Update (352 | 382) ####, loss = 0.36906567\n",
      "####Model Update (384 | 382) ####, loss = 0.36964992\n",
      "mean loss: tensor(0.5050, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.42746061\n",
      "####Model Update ( 32 | 382) ####, loss = 0.36898637\n",
      "####Model Update ( 64 | 382) ####, loss = 0.37726617\n",
      "####Model Update ( 96 | 382) ####, loss = 0.60732681\n",
      "####Model Update (128 | 382) ####, loss = 0.56763554\n",
      "####Model Update (160 | 382) ####, loss = 0.30572170\n",
      "####Model Update (192 | 382) ####, loss = 0.44013095\n",
      "####Model Update (224 | 382) ####, loss = 0.41365290\n",
      "####Model Update (256 | 382) ####, loss = 0.50691950\n",
      "####Model Update (288 | 382) ####, loss = 0.51814646\n",
      "####Model Update (320 | 382) ####, loss = 0.49772942\n",
      "####Model Update (352 | 382) ####, loss = 0.35565287\n",
      "####Model Update (384 | 382) ####, loss = 0.27764788\n",
      "mean loss: tensor(0.4720, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.42328525\n",
      "####Model Update ( 32 | 382) ####, loss = 0.33667454\n",
      "####Model Update ( 64 | 382) ####, loss = 0.35830066\n",
      "####Model Update ( 96 | 382) ####, loss = 0.58941829\n",
      "####Model Update (128 | 382) ####, loss = 0.55233103\n",
      "####Model Update (160 | 382) ####, loss = 0.28771985\n",
      "####Model Update (192 | 382) ####, loss = 0.42101941\n",
      "####Model Update (224 | 382) ####, loss = 0.39062461\n",
      "####Model Update (256 | 382) ####, loss = 0.47713706\n",
      "####Model Update (288 | 382) ####, loss = 0.49490443\n",
      "####Model Update (320 | 382) ####, loss = 0.48633116\n",
      "####Model Update (352 | 382) ####, loss = 0.34123385\n",
      "####Model Update (384 | 382) ####, loss = 0.24210271\n",
      "mean loss: tensor(0.4501, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.40696856\n",
      "####Model Update ( 32 | 382) ####, loss = 0.31649801\n",
      "####Model Update ( 64 | 382) ####, loss = 0.34402138\n",
      "####Model Update ( 96 | 382) ####, loss = 0.57614595\n",
      "####Model Update (128 | 382) ####, loss = 0.54009944\n",
      "####Model Update (160 | 382) ####, loss = 0.27415991\n",
      "####Model Update (192 | 382) ####, loss = 0.40636981\n",
      "####Model Update (224 | 382) ####, loss = 0.37203699\n",
      "####Model Update (256 | 382) ####, loss = 0.45338461\n",
      "####Model Update (288 | 382) ####, loss = 0.47711647\n",
      "####Model Update (320 | 382) ####, loss = 0.47702494\n",
      "####Model Update (352 | 382) ####, loss = 0.32514113\n",
      "####Model Update (384 | 382) ####, loss = 0.27754772\n",
      "mean loss: tensor(0.4372, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.39424652\n",
      "####Model Update ( 32 | 382) ####, loss = 0.30289963\n",
      "####Model Update ( 64 | 382) ####, loss = 0.33405861\n",
      "####Model Update ( 96 | 382) ####, loss = 0.56428915\n",
      "####Model Update (128 | 382) ####, loss = 0.52969021\n",
      "####Model Update (160 | 382) ####, loss = 0.26423424\n",
      "####Model Update (192 | 382) ####, loss = 0.39493051\n",
      "####Model Update (224 | 382) ####, loss = 0.35726202\n",
      "####Model Update (256 | 382) ####, loss = 0.43483183\n",
      "####Model Update (288 | 382) ####, loss = 0.46366191\n",
      "####Model Update (320 | 382) ####, loss = 0.46801823\n",
      "####Model Update (352 | 382) ####, loss = 0.30584675\n",
      "####Model Update (384 | 382) ####, loss = 0.27515951\n",
      "mean loss: tensor(0.4241, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.41293576\n",
      "####Model Update ( 32 | 382) ####, loss = 0.28969669\n",
      "####Model Update ( 64 | 382) ####, loss = 0.32559812\n",
      "####Model Update ( 96 | 382) ####, loss = 0.55632806\n",
      "####Model Update (128 | 382) ####, loss = 0.52067786\n",
      "####Model Update (160 | 382) ####, loss = 0.25668061\n",
      "####Model Update (192 | 382) ####, loss = 0.38128462\n",
      "####Model Update (224 | 382) ####, loss = 0.34634960\n",
      "####Model Update (256 | 382) ####, loss = 0.41869473\n",
      "####Model Update (288 | 382) ####, loss = 0.45220137\n",
      "####Model Update (320 | 382) ####, loss = 0.45848414\n",
      "####Model Update (352 | 382) ####, loss = 0.31469816\n",
      "####Model Update (384 | 382) ####, loss = 0.21639198\n",
      "mean loss: tensor(0.4125, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.37770107\n",
      "####Model Update ( 32 | 382) ####, loss = 0.28299329\n",
      "####Model Update ( 64 | 382) ####, loss = 0.31885219\n",
      "####Model Update ( 96 | 382) ####, loss = 0.54874569\n",
      "####Model Update (128 | 382) ####, loss = 0.51183408\n",
      "####Model Update (160 | 382) ####, loss = 0.24950810\n",
      "####Model Update (192 | 382) ####, loss = 0.37161815\n",
      "####Model Update (224 | 382) ####, loss = 0.33534664\n",
      "####Model Update (256 | 382) ####, loss = 0.40428761\n",
      "####Model Update (288 | 382) ####, loss = 0.44189578\n",
      "####Model Update (320 | 382) ####, loss = 0.44889787\n",
      "####Model Update (352 | 382) ####, loss = 0.29856253\n",
      "####Model Update (384 | 382) ####, loss = 0.20573258\n",
      "mean loss: tensor(0.3997, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.40841416\n",
      "####Model Update ( 32 | 382) ####, loss = 0.27455360\n",
      "####Model Update ( 64 | 382) ####, loss = 0.31341320\n",
      "####Model Update ( 96 | 382) ####, loss = 0.54203731\n",
      "####Model Update (128 | 382) ####, loss = 0.50396949\n",
      "####Model Update (160 | 382) ####, loss = 0.24443012\n",
      "####Model Update (192 | 382) ####, loss = 0.36159682\n",
      "####Model Update (224 | 382) ####, loss = 0.32466429\n",
      "####Model Update (256 | 382) ####, loss = 0.39169610\n",
      "####Model Update (288 | 382) ####, loss = 0.43322241\n",
      "####Model Update (320 | 382) ####, loss = 0.43903512\n",
      "####Model Update (352 | 382) ####, loss = 0.27889913\n",
      "####Model Update (384 | 382) ####, loss = 0.16943291\n",
      "mean loss: tensor(0.3904, device='cuda:0')\n",
      "####Model Update (  0 | 382) ####, loss = 0.36506677\n",
      "####Model Update ( 32 | 382) ####, loss = 0.26845479\n",
      "####Model Update ( 64 | 382) ####, loss = 0.30754960\n",
      "####Model Update ( 96 | 382) ####, loss = 0.53469121\n",
      "####Model Update (128 | 382) ####, loss = 0.49678671\n",
      "####Model Update (160 | 382) ####, loss = 0.23845673\n",
      "####Model Update (192 | 382) ####, loss = 0.35411179\n",
      "####Model Update (224 | 382) ####, loss = 0.31629401\n",
      "####Model Update (256 | 382) ####, loss = 0.38053927\n",
      "####Model Update (288 | 382) ####, loss = 0.42483586\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Model Update (320 | 382) ####, loss = 0.43249768\n",
      "####Model Update (352 | 382) ####, loss = 0.27731514\n",
      "####Model Update (384 | 382) ####, loss = 0.14865395\n",
      "mean loss: tensor(0.3788, device='cuda:0')\n",
      "%3d | %3d Post-MetaTrain Performance of model1: (0.7757201646090535, tensor(0.4653, device='cuda:0'), 0.5720081135902637, 0.9757785467128027, 0.7212276214833759)\n"
     ]
    }
   ],
   "source": [
    "    # IR_weighting.ConstructExpandData(batch_size=32)\n",
    "    exp_idxs, valid_indices = IR_weighting.BalancedTraining(entrophy, max_epoch=10, batch_size=32, max_meta_steps=3,\n",
    "                                                lr4weights=0.1, meta_lr4model=1e-1, meta_scale_lr4model=5e-4)\n",
    "    # expand_set_idxs.extend(exp_idxs)\n",
    "    # model1.load_model(\"./%s/MetaBiGCN_%s.pkl\"%(log_dir, new_domain_name))\n",
    "    rst_model1 = model1.valid(Bi_new_domain_loader, all_metrics=True)\n",
    "    print(\"%3d | %3d Post-MetaTrain Performance of model1:\", rst_model1)\n",
    "    pseaudo_labels = torch.tensor(IR_weighting.weak_set.data_y).argmax(dim=1)\n",
    "    acc_s, (p_s, r_s, f1_s, _) = acc_P_R_F1(new_domain_label[valid_indices],\n",
    "                                    pseaudo_labels[valid_indices])\n",
    "    acc_p, (p_p, r_p, f1_p, _) = acc_P_R_F1(new_domain_label[pseaudo_idxs],\n",
    "                                    pseaudo_labels[pseaudo_idxs])\n",
    "    acc_t, (p_t, r_t, f1_t, _) = acc_P_R_F1(new_domain_label[pseaudo_idxs+valid_indices],\n",
    "                                    pseaudo_labels[pseaudo_idxs+valid_indices])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.8, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.\n",
      "  warnings.warn(warning.format(ret))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot   0 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.56992918/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.55993903/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.55138725/0.7500000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.54428881/0.7600000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53865498/0.7500000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53449070/0.7600000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53179473/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53055578/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53074354/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53170234/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53271753/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53346419/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53382611/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53380114/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53344828/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53285891/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53214103/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53140950/0.7400000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.53078210/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2343, device='cuda:1'), 0.7, 0.5)\n",
      "=====> Optimized weights: tensor([-0.6339, -0.4885,  1.0466, -0.7215, -0.7290, -0.9396, -0.6172,  1.0730,\n",
      "        -0.4228, -0.6739, -0.6480,  1.1172, -0.8586,  1.0476, -0.7838, -0.4933,\n",
      "        -0.7449, -0.5963, -0.7072, -0.7505], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.7, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.56799036/0.7300000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.55667007/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.54740846/0.7500000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.54022264/0.7500000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53511465/0.7600000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53207195/0.7300000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53106070/0.7300000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53164339/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53269976/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53354335/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53392470/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53381521/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53330022/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53252143/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53164750/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53085637/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53032571/0.7400000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53020889/0.7300000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.53039628/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2956, device='cuda:1'), 0.9, 1.0)\n",
      "=====> Optimized weights: tensor([-0.8660, -0.4758, -0.5995,  1.0380, -0.5815,  0.9658, -0.3872,  0.0503,\n",
      "        -0.8204, -0.1455, -0.3380,  0.8773, -0.4680, -0.5049, -1.0382, -0.1125,\n",
      "         0.6575, -0.4216, -0.4432,  0.8225], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.8, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.56760329/0.7300000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.55597472/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.54648304/0.7600000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53915137/0.7500000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53399080/0.7500000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53100032/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53016549/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53080511/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53171527/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53235960/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53256643/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53235012/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53181875/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53112829/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53045571/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.52998489/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.52989250/0.7400000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53005779/0.7500000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.53019291/0.7400000\n",
      "=====> Optimized acc: (tensor(0.3045, device='cuda:1'), 0.9, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([ 0.7529, -0.1642, -0.4053, -0.3807,  0.3975,  0.7963, -0.4084, -0.0449,\n",
      "        -0.3347, -0.6142, -0.6400, -0.2995, -0.3805, -0.2719, -0.8086,  1.0307,\n",
      "         1.0057, -0.2901, -0.3517,  0.7835], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.6, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.57090384/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.56163538/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.55354780/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.54665202/0.7500000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.54095459/0.7500000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53645724/0.7600000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53315580/0.7500000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53104037/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53009087/0.7300000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53023410/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53094465/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53170854/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53227234/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53253633/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53249127/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53218001/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53167546/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53106660/0.7400000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.53045005/0.7400000\n",
      "=====> Optimized acc: (tensor(0.3267, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-0.9445, -1.1456, -1.1224, -0.9683, -0.7731, -1.0868, -1.1404, -0.8099,\n",
      "        -1.0245, -1.1923, -0.6279,  1.1595,  0.6779, -0.7335, -0.7740, -0.9273,\n",
      "         1.1935, -1.0637,  1.0959,  1.0210], device='cuda:1')\n",
      "=====> init acc: (tensor(0., device='cuda:1'), 0.5, 0.5)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.57133597/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.56239676/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.55453402/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.54775852/0.7500000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.54207814/0.7500000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53749824/0.7500000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53402066/0.7500000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53164434/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53036332/0.7500000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53016561/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53068280/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53135622/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53189301/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53217131/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53216976/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53192633/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53151143/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53101254/0.7400000\n",
      "####Few Shot  80 | 972 ####, loss/acc = 0.53052503/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1450, device='cuda:1'), 0.6, 0.6)\n",
      "=====> Optimized weights: tensor([-0.9045, -0.8185,  1.1918, -0.7201,  1.0065, -0.5996, -1.0183, -0.8272,\n",
      "        -1.1506, -1.1888,  0.9485,  1.2695, -1.0076, -0.9828, -0.7035, -0.9854,\n",
      "         1.0841, -0.7568, -0.8072, -1.1179], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(-0.1000, device='cuda:1'), 0.2, 0.45)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.56997687/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.56004268/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.55155516/0.7500000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.54452813/0.7600000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53896904/0.7500000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53488058/0.7600000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53225905/0.7300000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53109288/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53132701/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53231317/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53336805/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53415674/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53455031/0.7500000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53453648/0.7500000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53417021/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53354204/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53276139/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53194505/0.7400000\n",
      "####Few Shot 100 | 972 ####, loss/acc = 0.53121096/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2904, device='cuda:1'), 0.7, 0.6)\n",
      "=====> Optimized weights: tensor([-1.2302,  1.0526, -0.8934, -0.8975, -0.8017, -1.2137,  1.0740, -0.7660,\n",
      "        -0.8655,  1.1178,  1.0688, -0.7747, -0.4355, -0.5919, -0.6162, -1.1324,\n",
      "        -0.6216, -0.6277,  1.1894, -0.7423], device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1000, device='cuda:1'), 0.5, 0.45)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.56812316/0.7300000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.55682653/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.54747671/0.7500000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.54008788/0.7500000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53466076/0.7600000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53118211/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.52962166/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.52991867/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53118032/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53248006/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53340560/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53381598/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53371871/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53320187/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53239685/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53145760/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.53054774/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.52983516/0.7400000\n",
      "####Few Shot 120 | 972 ####, loss/acc = 0.52948767/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2619, device='cuda:1'), 0.6, 0.5714285714285714)\n",
      "=====> Optimized weights: tensor([-0.2602, -0.5655,  0.8360,  0.6368, -0.5678, -0.8367,  0.7760, -0.8776,\n",
      "         0.7106,  0.7746, -0.6326, -0.4027, -0.5470, -0.9694, -0.5640, -0.6217,\n",
      "        -0.7431, -0.8168,  0.7943,  0.8422], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.8, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.56712747/0.7300000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.55522007/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.54564744/0.7600000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53842330/0.7500000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53354514/0.7500000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53099465/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53073555/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53185117/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53311288/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53397542/0.7500000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53426886/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53401870/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53335172/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53244358/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53149134/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53069556/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53025031/0.7400000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53029966/0.7500000\n",
      "####Few Shot 140 | 972 ####, loss/acc = 0.53058815/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0138, device='cuda:1'), 0.7, 0.625)\n",
      "=====> Optimized weights: tensor([ 0.7965, -0.6874, -0.5977, -0.4908, -0.1163,  1.0118, -0.2639,  0.7564,\n",
      "        -0.5041,  0.7786,  0.7968, -0.4858, -0.2207,  0.8158, -0.2363,  0.8777,\n",
      "        -0.7230, -0.6801,  0.8259, -0.1227], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.7, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.57047212/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.56090462/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.55265212/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.54572701/0.7600000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.54013878/0.7500000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53589427/0.7500000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53299630/0.7500000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53144401/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53121632/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53182775/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53260064/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53317320/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53340489/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53328520/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53287709/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53228301/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53162384/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53102595/0.7400000\n",
      "####Few Shot 160 | 972 ####, loss/acc = 0.53061080/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2438, device='cuda:1'), 0.7, 0.65)\n",
      "=====> Optimized weights: tensor([-0.6821, -0.5174, -0.8203, -0.6889, -0.7603, -0.8059, -0.7823, -0.8972,\n",
      "        -0.8944, -1.0161, -0.8435, -0.9429, -1.1029, -0.8798, -0.7272, -1.0730,\n",
      "        -0.9047, -1.2241, -0.6759, -0.7822], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.8, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.56769133/0.7300000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.55618757/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.54686004/0.7600000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53972703/0.7500000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53479218/0.7500000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53203917/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53143084/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53220534/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53319031/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53388768/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53414041/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53396273/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53345615/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53276491/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53205454/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53149843/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53127187/0.7300000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 180 | 972 ####, loss/acc = 0.53140491/0.7400000\n",
      "####Few Shot 180 | 972 ####, loss/acc = 0.53163040/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1032, device='cuda:1'), 0.9, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.3304, -0.2853, -0.3557,  0.9392, -0.3447,  0.6943,  0.7681, -0.7400,\n",
      "        -0.2086, -0.2361, -0.5054,  1.1283,  1.0293, -0.2223, -0.4408, -0.5485,\n",
      "        -0.5145, -0.6231,  0.8835, -0.6018], device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1000, device='cuda:1'), 0.6, 0.45)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.56836587/0.7300000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.55728394/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.54811972/0.7500000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.54089046/0.7500000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53560305/0.7500000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53225446/0.7300000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53083086/0.7300000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53119528/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53247046/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53379852/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53475916/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53519785/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53511161/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53458172/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53373492/0.7300000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53272021/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53169531/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53081685/0.7400000\n",
      "####Few Shot 200 | 972 ####, loss/acc = 0.53023356/0.7400000\n",
      "=====> Optimized acc: (tensor(0.6908, device='cuda:1'), 0.7, 1.0)\n",
      "=====> Optimized weights: tensor([-0.8417, -0.6667, -0.2495, -0.5103, -0.6680,  0.9285,  0.8455, -0.6312,\n",
      "         0.8991, -0.5270, -0.8382, -0.1964, -1.0055, -0.6975,  0.8893, -0.6030,\n",
      "        -0.7373,  0.9200, -0.7223, -0.8932], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.56535715/0.7300000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.55228007/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.54214919/0.7500000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53498334/0.7500000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53078103/0.7300000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.52951574/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53023714/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53124410/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53184438/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53187400/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53141952/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53068441/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.52992439/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.52941346/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.52942133/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.52975798/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53001744/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.53004092/0.7400000\n",
      "####Few Shot 220 | 972 ####, loss/acc = 0.52983534/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1332, device='cuda:1'), 0.7, 0.75)\n",
      "=====> Optimized weights: tensor([-0.3344, -0.4083, -0.6110, -1.2076, -0.2332, -0.1842,  0.9250,  0.6875,\n",
      "        -0.6739,  0.7964,  0.0388,  0.7002,  0.3967, -0.4248, -0.5548,  0.7427,\n",
      "        -0.8486, -0.1816, -0.4939,  0.6908], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.8, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.56957728/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.55936420/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.55071932/0.7500000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.54365683/0.7500000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53818518/0.7500000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53430635/0.7500000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53201610/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53129911/0.7300000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53182387/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53283101/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53377801/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53440017/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53460646/0.7500000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53441054/0.7500000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53388572/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53313798/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53228945/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53146756/0.7400000\n",
      "####Few Shot 240 | 972 ####, loss/acc = 0.53079665/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1560, device='cuda:1'), 0.8, 0.875)\n",
      "=====> Optimized weights: tensor([ 0.9303,  0.9417, -0.9514,  0.9352, -0.3709,  0.9714,  1.1320, -0.8863,\n",
      "        -0.7059, -1.0624, -0.7826,  0.9824, -0.5604,  1.0542, -0.6117, -0.5609,\n",
      "         1.0275, -0.6908, -0.7007, -0.5928], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.56983578/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.55978739/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.55121243/0.7500000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.54412222/0.7600000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53852332/0.7500000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53441602/0.7500000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53179693/0.7300000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53066045/0.7300000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53096408/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53204703/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53320545/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53408349/0.7500000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53453791/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53455108/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53417850/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53351575/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53268105/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53180003/0.7400000\n",
      "####Few Shot 260 | 972 ####, loss/acc = 0.53099948/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2316, device='cuda:1'), 0.7, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.8418, -1.0498, -0.9388, -0.8691, -1.0471, -1.0940, -0.7837,  1.0830,\n",
      "        -0.4669,  1.1856,  0.9676, -0.9906, -0.8654, -0.8128, -1.1630, -0.9248,\n",
      "        -0.7189, -0.8615, -0.8021, -0.8753], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.57278997/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.56503236/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.55807573/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.55192733/0.7500000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.54659271/0.7600000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.54207498/0.7500000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53837484/0.7500000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53549004/0.7500000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53341532/0.7400000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 280 | 972 ####, loss/acc = 0.53214377/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53166074/0.7300000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53187865/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53244233/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53303516/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53348899/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53373086/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53374821/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53356457/0.7400000\n",
      "####Few Shot 280 | 972 ####, loss/acc = 0.53322482/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.1511, device='cuda:1'), 0.8, 0.75)\n",
      "=====> Optimized weights: tensor([-1.3145, -1.4140, -1.2623, -1.2119, -1.2902, -1.1085,  1.3871, -1.2456,\n",
      "         1.4774, -1.4153, -1.4132,  1.4432, -0.9513, -1.2003, -1.0585,  1.3149,\n",
      "        -1.3575, -1.3797, -1.0652, -1.2119], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.6, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.56761259/0.7300000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.55599362/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.54651421/0.7600000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53919220/0.7500000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53403091/0.7500000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53101373/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53010494/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53080773/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53202784/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53311777/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53380215/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53400612/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53376395/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53316766/0.7500000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53234047/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53142065/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.53055364/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.52988607/0.7400000\n",
      "####Few Shot 300 | 972 ####, loss/acc = 0.52955818/0.7400000\n",
      "=====> Optimized acc: (tensor(0.7329, device='cuda:1'), 0.9, 0.9)\n",
      "=====> Optimized weights: tensor([ 0.9458, -0.2838,  0.9211,  0.6579,  0.8928, -0.3842,  0.9770,  0.0170,\n",
      "        -0.2075,  0.8593, -0.6588,  1.0328, -0.5185, -0.6887,  0.9853, -0.4057,\n",
      "         0.7010, -0.3086, -0.7580, -0.2473], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.9, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.57207328/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.56371593/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.55627823/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.54976833/0.7500000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.54419178/0.7600000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53955019/0.7500000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53584141/0.7600000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53306067/0.7500000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53119934/0.7300000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53024501/0.7300000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53018004/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53070772/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53140008/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53200918/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53241396/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53257251/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53249335/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53221434/0.7400000\n",
      "####Few Shot 320 | 972 ####, loss/acc = 0.53179121/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2417, device='cuda:1'), 0.9, 1.0)\n",
      "=====> Optimized weights: tensor([-1.3444, -1.0143, -1.3649,  1.1371, -1.1571,  1.3233,  1.1919,  1.3264,\n",
      "        -1.1044, -1.1824,  1.3048, -1.2554, -1.0890, -1.1724,  1.2055, -0.9143,\n",
      "        -1.3147, -1.1957, -1.0814, -1.2933], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.9, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.57010984/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.56023985/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.55174702/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.54464698/0.7600000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53895223/0.7500000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53467107/0.7600000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53180796/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53035963/0.7500000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53030878/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53108001/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53194368/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53256613/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53283036/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53273886/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53235799/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53178889/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53114951/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53056496/0.7400000\n",
      "####Few Shot 340 | 972 ####, loss/acc = 0.53016114/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.3221, device='cuda:1'), 0.8, 0.75)\n",
      "=====> Optimized weights: tensor([-0.7568, -0.6922,  0.9715, -0.5452, -0.6414,  1.0460, -0.7491, -0.5738,\n",
      "        -0.7751, -0.8338, -0.9803,  0.9739, -0.8819, -0.5329, -0.7840, -0.8178,\n",
      "         0.7967, -0.5116, -0.6546, -0.5989], device='cuda:1')\n",
      "=====> init acc: (tensor(0.1000, device='cuda:1'), 0.5, 0.55)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.56993365/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.55996996/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.55146754/0.7500000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.54444307/0.7500000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53891075/0.7500000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53488094/0.7500000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53235716/0.7300000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53133380/0.7300000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53173488/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53280431/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53385633/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53458476/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53488892/0.7300000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53478086/0.7300000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53433418/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53365517/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53286707/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53210020/0.7400000\n",
      "####Few Shot 360 | 972 ####, loss/acc = 0.53148705/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0572, device='cuda:1'), 0.7, 0.5)\n",
      "=====> Optimized weights: tensor([-1.0032, -0.6516, -0.8444, -0.6010,  0.9954, -0.8491, -0.8848, -1.1270,\n",
      "        -0.7740, -0.4294, -0.9129,  1.0088, -0.4475,  1.0013, -0.5987,  0.7545,\n",
      "         0.8628,  0.8390, -0.9302, -0.5424], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.9, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.56901431/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.55837673/0.7400000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 380 | 972 ####, loss/acc = 0.54945105/0.7500000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.54225582/0.7500000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53680241/0.7500000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53309369/0.7500000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53111988/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53085047/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53158516/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53243387/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53301388/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53320348/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53301901/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53254771/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53191435/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53126162/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53073835/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53049374/0.7400000\n",
      "####Few Shot 380 | 972 ####, loss/acc = 0.53058624/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2000, device='cuda:1'), 0.7, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.4974,  0.7167, -0.5079,  0.9053,  0.7514, -0.5363, -0.6562, -0.5069,\n",
      "        -0.2322, -0.4417,  0.9353,  0.8448, -0.5876, -0.7055, -0.5197, -0.3889,\n",
      "        -0.3879, -0.4842, -0.7380,  1.0200], device='cuda:1')\n",
      "=====> init acc: (tensor(0.7000, device='cuda:1'), 0.9, 0.85)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.57021374/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.56043959/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.55203527/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.54501444/0.7600000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53938496/0.7500000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53514868/0.7500000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53230023/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53082597/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53069478/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53136230/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53214806/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53273380/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53300112/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53294235/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53261244/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53210038/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53151244/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53096372/0.7400000\n",
      "####Few Shot 400 | 972 ####, loss/acc = 0.53057152/0.7400000\n",
      "=====> Optimized acc: (tensor(0.3909, device='cuda:1'), 0.9, 0.9090909090909091)\n",
      "=====> Optimized weights: tensor([-0.4135, -0.7953, -0.6626, -0.8619,  0.9900,  0.8758, -0.8049, -0.4908,\n",
      "        -0.6870,  1.0624,  0.7759,  1.0483, -0.4923,  0.9881,  0.9059,  0.8381,\n",
      "         1.1492,  1.1155,  0.8640, -0.6171], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.7, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.57375616/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.56677580/0.7300000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.56040490/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.55464906/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.54951239/0.7500000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.54499799/0.7600000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.54110670/0.7500000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53783846/0.7500000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53519094/0.7500000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53316033/0.7500000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53174096/0.7300000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53092396/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53069508/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53092474/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53135729/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53179812/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53213793/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53232622/0.7400000\n",
      "####Few Shot 420 | 972 ####, loss/acc = 0.53235149/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2046, device='cuda:1'), 0.9, 1.0)\n",
      "=====> Optimized weights: tensor([ 1.4206, -1.6949, -1.4635,  1.6158, -1.6054, -1.6334, -1.5845,  1.4707,\n",
      "        -1.2399, -1.5216,  1.6261,  1.6474,  1.3675, -1.6644, -1.5422,  1.5534,\n",
      "        -1.5429,  1.4811, -1.4588, -1.3601], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.7, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.57191283/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.56342465/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.55588627/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.54930764/0.7500000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.54369652/0.7500000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53905749/0.7500000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53539276/0.7600000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53269982/0.7500000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53097081/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53019220/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53032243/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53095418/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53166062/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53222442/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53255093/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53261924/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53245217/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53209871/0.7400000\n",
      "####Few Shot 440 | 972 ####, loss/acc = 0.53162271/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1604, device='cuda:1'), 0.9, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-1.1367, -1.2208, -1.0599,  1.2190, -0.8351,  1.2865, -1.2574, -1.2758,\n",
      "        -1.2453, -1.1340, -1.0121, -0.9503,  1.1787, -1.1024, -1.3768,  1.3473,\n",
      "        -1.2071,  1.1222,  1.2871,  1.1761], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.7, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.56957412/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.55930096/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.55053902/0.7500000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.54330301/0.7500000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53760165/0.7500000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53343654/0.7500000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53080052/0.7300000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.52967614/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53001481/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53110641/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53224546/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53310513/0.7500000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53356177/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53360438/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53328311/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53268248/0.7500000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53190470/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53106105/0.7400000\n",
      "####Few Shot 460 | 972 ####, loss/acc = 0.53026730/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2337, device='cuda:1'), 0.8, 0.75)\n",
      "=====> Optimized weights: tensor([-0.7123, -0.6195, -0.4578, -0.8886, -0.7020,  1.0488,  1.1800, -0.4181,\n",
      "        -0.7876,  0.9224, -0.8060,  0.9321,  0.8951,  0.8809,  1.0750, -0.7021,\n",
      "        -1.1156,  0.8517, -0.6514, -0.4066], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.6, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.56629062/0.7300000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.55379665/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.54389554/0.7600000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53660965/0.7500000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53194296/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.52987701/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53035080/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53200293/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53354049/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53447157/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53468573/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53426093/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53336793/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53222030/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53105032/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53009409/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.52958524/0.7400000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.52972579/0.7500000\n",
      "####Few Shot 480 | 972 ####, loss/acc = 0.53022283/0.7400000\n",
      "=====> Optimized acc: (tensor(0.4061, device='cuda:1'), 0.8, 0.7142857142857143)\n",
      "=====> Optimized weights: tensor([-0.2351, -0.1764, -0.4484, -0.3592,  0.7282, -0.0983, -0.6328, -0.6406,\n",
      "        -0.1543,  0.6423, -0.4956,  0.5803, -0.4688,  0.7431, -0.2149,  0.7308,\n",
      "        -0.4067,  0.6961,  0.8699, -0.0997], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.5, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.57007986/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.56021601/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.55176425/0.7500000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.54473722/0.7600000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53914458/0.7500000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53499073/0.7600000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53227603/0.7300000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53099489/0.7200000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53109217/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53199095/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53301805/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53381437/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53423017/0.7500000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53424084/0.7500000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53389424/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53327918/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53250605/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53169394/0.7400000\n",
      "####Few Shot 500 | 972 ####, loss/acc = 0.53096372/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2298, device='cuda:1'), 0.9, 1.0)\n",
      "=====> Optimized weights: tensor([-0.8986, -0.9622, -0.5286, -0.6406,  1.0862, -0.5481, -0.9333,  1.0454,\n",
      "        -0.5877, -0.9676, -0.8581, -1.0748, -0.9949,  1.1161, -0.7612, -1.0232,\n",
      "         1.0403, -0.6668, -0.8064, -1.0107], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.8, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.57537854/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.56978428/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.56455946/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.55970699/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.55522901/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.55112791/0.7500000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.54740542/0.7500000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.54406297/0.7500000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.54110163/0.7500000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53852177/0.7500000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53632361/0.7700000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53450662/0.7500000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53307009/0.7500000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53201205/0.7300000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53132999/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53101927/0.7300000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53104824/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53128475/0.7400000\n",
      "####Few Shot 520 | 972 ####, loss/acc = 0.53158575/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2074, device='cuda:1'), 0.7, 0.7142857142857143)\n",
      "=====> Optimized weights: tensor([-1.9587, -1.8866, -1.9575, -1.8327, -1.8872, -1.8302,  1.8493,  1.8088,\n",
      "        -1.7668, -1.8430, -1.9093, -1.9183,  1.5857,  1.8510, -1.8528,  1.7520,\n",
      "        -1.6778, -1.9685,  1.8898,  1.8927], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.5, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.57031709/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.56060863/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.55223095/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.54519671/0.7600000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53951508/0.7500000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53518993/0.7600000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53221941/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53059453/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53029817/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53087169/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53162622/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53222305/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53252584/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53251433/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53223252/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53176016/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53119659/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53064966/0.7400000\n",
      "####Few Shot 540 | 972 ####, loss/acc = 0.53022933/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0423, device='cuda:1'), 0.6, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([ 1.0671,  0.8606, -0.7421, -0.9425,  0.9468,  1.1223, -0.4861,  1.0460,\n",
      "        -0.7555,  1.0118, -0.6586, -0.7887, -0.8194, -0.6824, -0.5958, -0.5636,\n",
      "        -0.6937, -0.8851, -0.7401, -0.5406], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.6, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.57087088/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.56157649/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.55346990/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.54656267/0.7600000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.54086268/0.7500000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53637362/0.7600000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53309512/0.7500000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53102207/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53014296/0.7300000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53039086/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53121978/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53209192/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53274053/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53306007/0.7300000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53304064/0.7300000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53272742/0.7400000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 560 | 972 ####, loss/acc = 0.53219646/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53154063/0.7400000\n",
      "####Few Shot 560 | 972 ####, loss/acc = 0.53086013/0.7400000\n",
      "=====> Optimized acc: (tensor(0.3284, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-1.0321, -0.7958,  1.2327, -0.8596,  1.0831,  1.0975, -0.7897, -0.9671,\n",
      "        -0.8600, -1.1393, -0.9464, -0.8984, -0.7173, -0.9015, -1.1675, -1.1566,\n",
      "        -1.1707,  1.2476, -0.6616, -0.9241], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.7, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.57294554/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.56530130/0.7300000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.55841458/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.55229163/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.54693776/0.7500000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.54235703/0.7500000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53855145/0.7500000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53552163/0.7600000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53326648/0.7500000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53178382/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53106683/0.7300000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53106481/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53152066/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53211904/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53265524/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53301996/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53316927/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53310221/0.7400000\n",
      "####Few Shot 580 | 972 ####, loss/acc = 0.53284597/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1448, device='cuda:1'), 0.7, 1.0)\n",
      "=====> Optimized weights: tensor([-1.4967,  1.3988, -1.3383, -1.3446, -0.9155,  1.4880, -1.3028, -1.3901,\n",
      "        -1.3839, -1.4791, -1.3691, -1.6523, -1.4185, -1.4410, -1.3822, -1.3001,\n",
      "        -1.3614,  1.4809, -1.3909, -1.5426], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.7, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.56997561/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.56000292/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.55143827/0.7500000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.54429549/0.7600000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53858316/0.7500000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53430444/0.7500000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53145796/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53003496/0.7500000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53000987/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53078210/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53164923/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53228176/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53255880/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53247637/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53209615/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53151506/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53084791/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.53021759/0.7400000\n",
      "####Few Shot 600 | 972 ####, loss/acc = 0.52974653/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1074, device='cuda:1'), 0.8, 0.7142857142857143)\n",
      "=====> Optimized weights: tensor([ 0.8936, -0.2851,  1.0365,  0.9848,  0.9824, -0.8517, -1.0521, -1.1041,\n",
      "        -0.4901, -0.8592, -0.7959, -0.6106, -1.0973, -0.6886, -0.5428, -0.6829,\n",
      "         1.0043,  0.8733, -0.7368,  1.0117], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.7, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.56841260/0.7300000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.55732363/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.54809785/0.7500000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.54075378/0.7500000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53530246/0.7600000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53174859/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53008795/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53030515/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53153431/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53280038/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53367460/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53401947/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53385335/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53327745/0.7500000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53243595/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53149235/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.53061634/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.52997655/0.7400000\n",
      "####Few Shot 620 | 972 ####, loss/acc = 0.52973151/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2154, device='cuda:1'), 0.7, 0.8)\n",
      "=====> Optimized weights: tensor([-0.6465, -0.8343, -0.4577, -0.5402,  0.9193, -0.3465, -0.5650, -0.8047,\n",
      "        -0.4364, -0.4012,  0.8368, -0.3464, -0.8491, -0.4526,  0.9254, -0.6448,\n",
      "         0.9124,  0.8561, -0.5048, -0.6923], device='cuda:1')\n",
      "=====> init acc: (tensor(0.7000, device='cuda:1'), 0.8, 0.85)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.56944543/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.55911762/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.55037820/0.7500000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.54324210/0.7500000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53771424/0.7500000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53378916/0.7500000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53144908/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53066343/0.7300000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53114772/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53214079/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53310430/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53378373/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53408736/0.7300000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53401685/0.7300000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53362757/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53300506/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53225130/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53147626/0.7400000\n",
      "####Few Shot 640 | 972 ####, loss/acc = 0.53079337/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.1172, device='cuda:1'), 0.8, 0.75)\n",
      "=====> Optimized weights: tensor([-0.7122,  1.0619,  1.0220, -0.5988, -0.4680,  1.0897,  1.1337, -1.0446,\n",
      "        -0.6626, -1.2262,  1.1085,  0.9790,  0.6865, -0.7660, -1.0510, -0.7428,\n",
      "        -0.5837, -0.5648, -0.5984,  0.9807], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.8, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.56775427/0.7300000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.55623525/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.54681474/0.7500000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53951758/0.7500000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53435934/0.7500000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53134650/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53046763/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53112042/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53209013/0.7400000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 660 | 972 ####, loss/acc = 0.53275824/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53293824/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53265923/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53205520/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53130889/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53062218/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53019869/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53021306/0.7300000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53048372/0.7400000\n",
      "####Few Shot 660 | 972 ####, loss/acc = 0.53070426/0.7400000\n",
      "=====> Optimized acc: (tensor(-8.2195e-05, device='cuda:1'), 0.9, 0.75)\n",
      "=====> Optimized weights: tensor([-0.3134, -0.4370, -0.7809, -0.7661, -0.5006, -0.4602, -0.5816, -0.1738,\n",
      "         1.0988, -0.2510, -0.5812, -0.4765, -0.4041, -0.9947,  0.5329, -0.5183,\n",
      "        -0.6357,  0.8947,  0.6278, -0.7172], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.5, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.57038540/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.56070137/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.55230397/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.54520667/0.7600000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53941923/0.7500000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53494465/0.7600000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53177923/0.7500000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.52990991/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.52930766/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.52972865/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53050578/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53120726/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53164595/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53176820/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53159487/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53118849/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53063422/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.53003103/0.7400000\n",
      "####Few Shot 680 | 972 ####, loss/acc = 0.52948385/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1215, device='cuda:1'), 0.8, 0.7142857142857143)\n",
      "=====> Optimized weights: tensor([-0.4251, -0.5115, -0.9466, -0.3594,  1.0110,  0.9425,  0.9997, -0.4665,\n",
      "        -1.0442, -0.6910,  0.9794,  1.0434, -0.4333,  0.9830, -0.8839, -0.9624,\n",
      "        -0.5604, -0.5828,  0.8777, -1.2754], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.7, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.56962854/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.55942941/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.55076259/0.7500000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.54364455/0.7500000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53808612/0.7500000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53409296/0.7500000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53166175/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53077698/0.7300000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53125876/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53230673/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53329176/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53393930/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53416640/0.7500000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53399479/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53350341/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53280145/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53201288/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53126842/0.7400000\n",
      "####Few Shot 700 | 972 ####, loss/acc = 0.53069955/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.1461, device='cuda:1'), 0.7, 0.6)\n",
      "=====> Optimized weights: tensor([-0.9846, -0.5474, -0.5355,  0.7966, -0.5888, -0.8233, -0.4392, -0.5998,\n",
      "        -0.6348,  0.9248,  1.0376, -1.0387, -0.9557, -0.8674,  0.9260, -0.7053,\n",
      "        -0.6768, -0.5808, -0.7373,  0.5792], device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1000, device='cuda:1'), 0.3, 0.45)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.56819403/0.7300000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.55700678/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.54780287/0.7500000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.54060036/0.7500000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53540915/0.7600000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53223205/0.7300000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53106493/0.7300000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53173327/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53315210/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53444976/0.7500000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53525335/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53546506/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53513658/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53439850/0.7500000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53342068/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53238922/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53149277/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53091246/0.7400000\n",
      "####Few Shot 720 | 972 ####, loss/acc = 0.53080910/0.7300000\n",
      "=====> Optimized acc: (tensor(0.2710, device='cuda:1'), 0.7, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.5610, -1.0137, -0.6864, -0.9928, -0.7466, -0.5678, -0.8270, -0.3850,\n",
      "        -0.3097, -0.8559, -0.7400, -0.8497, -0.7016, -0.7274, -0.7734,  1.0200,\n",
      "         0.6911, -0.7725, -0.6910,  0.7784], device='cuda:1')\n",
      "=====> init acc: (tensor(0.1000, device='cuda:1'), 0.8, 0.55)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.56851399/0.7300000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.55749339/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.54830402/0.7500000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.54096532/0.7500000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53548461/0.7500000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53185594/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53005606/0.7500000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53003442/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53105026/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53222066/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53313345/0.7500000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53363001/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53368837/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53336090/0.7500000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53274077/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53194290/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53109342/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.53032458/0.7400000\n",
      "####Few Shot 740 | 972 ####, loss/acc = 0.52977008/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.2764, device='cuda:1'), 0.4, 0.375)\n",
      "=====> Optimized weights: tensor([ 1.1075, -0.4359, -0.3969,  0.8438, -0.4079, -0.5300, -0.3711, -0.3216,\n",
      "         1.0092, -0.5068, -0.7284, -0.3287,  0.8631,  0.8691, -0.6608, -0.7555,\n",
      "         0.8791, -0.6924,  0.8711,  0.9379], device='cuda:1')\n",
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.7, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.56748009/0.7300000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 760 | 972 ####, loss/acc = 0.55587411/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.54655266/0.7600000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53953397/0.7500000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53482264/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53241110/0.7300000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53227365/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53348875/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53491569/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53599840/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53652400/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53646898/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53591216/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53498638/0.7500000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53385115/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53267550/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53162861/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53086942/0.7400000\n",
      "####Few Shot 760 | 972 ####, loss/acc = 0.53052771/0.7300000\n",
      "=====> Optimized acc: (tensor(0.1025, device='cuda:1'), 0.7, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-6.6638e-01, -8.0734e-01, -4.6124e-01, -2.0285e-01,  8.8167e-01,\n",
      "        -6.2283e-01, -4.4534e-01, -2.5019e-01, -3.7217e-01, -4.8111e-01,\n",
      "         8.7953e-01,  1.0366e+00, -1.0351e+00,  9.6809e-01, -7.6859e-01,\n",
      "        -1.9159e-01, -7.7034e-01,  3.7588e-05,  1.0871e+00, -6.8301e-01],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.6, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.57154387/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.56277055/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.55503047/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.54833174/0.7500000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.54268110/0.7500000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53808290/0.7500000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53453970/0.7600000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53205204/0.7300000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53061742/0.7300000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53021550/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53056318/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53118491/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53174382/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53207356/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53211963/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53189719/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53146207/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53089339/0.7400000\n",
      "####Few Shot 780 | 972 ####, loss/acc = 0.53028011/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.0143, device='cuda:1'), 0.9, 1.0)\n",
      "=====> Optimized weights: tensor([ 1.2694, -1.3491, -1.1427, -1.2330, -0.8586, -0.9407, -0.9011, -1.1988,\n",
      "        -1.2343, -0.9132, -1.1404, -1.2401, -1.2478, -0.8190, -1.0726, -1.3238,\n",
      "        -1.0290, -0.6424, -1.0644,  1.3126], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.6, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.56946498/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.55912161/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.55033022/0.7500000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.54310799/0.7500000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53746766/0.7500000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53341675/0.7500000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53095567/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53007734/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53052062/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53148627/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53240168/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53301084/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53323168/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53307772/0.7500000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53261501/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53193790/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53115630/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.53038669/0.7400000\n",
      "####Few Shot 800 | 972 ####, loss/acc = 0.52974784/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1059, device='cuda:1'), 0.9, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.2771, -0.8445, -0.2713, -0.4633, -0.5201, -0.6349, -0.9860, -0.7482,\n",
      "         0.9057, -0.2602,  1.0111, -0.4672,  0.9771,  1.1477,  1.0629, -0.3134,\n",
      "         1.0684, -0.1204, -0.6437, -0.3758], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.9, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.57099444/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.56180954/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.55379933/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.54697424/0.7600000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.54133898/0.7500000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53689367/0.7500000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53363311/0.7500000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53154683/0.7300000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53061646/0.7300000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53078532/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53153276/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53233528/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53293639/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53323412/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53321719/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53292680/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53243279/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53182155/0.7400000\n",
      "####Few Shot 820 | 972 ####, loss/acc = 0.53118616/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2317, device='cuda:1'), 0.9, 0.8888888888888888)\n",
      "=====> Optimized weights: tensor([-1.1009, -0.8664,  1.1721, -0.9815, -0.8852,  1.2495, -1.0087, -0.8449,\n",
      "         1.2819, -0.7767, -0.8789,  1.2228,  1.1756,  1.2140, -0.7514, -0.7082,\n",
      "         1.1758,  1.0035,  0.9402, -0.9334], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.8, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.56559730/0.7300000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.55272901/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.54277760/0.7500000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53576010/0.7600000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53166401/0.7300000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53043008/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53126127/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53256357/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53349543/0.7500000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53380436/0.7500000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53351235/0.7500000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53277254/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53179985/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53083825/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53014380/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.52997679/0.7300000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53025335/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53056371/0.7400000\n",
      "####Few Shot 840 | 972 ####, loss/acc = 0.53068060/0.7400000\n",
      "=====> Optimized acc: (tensor(0.2717, device='cuda:1'), 0.8, 0.8)\n",
      "=====> Optimized weights: tensor([ 0.4818, -0.6049, -0.6044,  0.7999,  0.6287,  0.7530, -0.2146,  0.9400,\n",
      "        -0.1589, -0.4685,  0.4068,  0.7059, -0.4265, -0.2716, -0.0369,  0.8314,\n",
      "         0.2880,  0.2230, -0.3619, -0.5513], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.2000, device='cuda:1'), 0.6, 0.6)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.57275659/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.56494641/0.7300000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.55791730/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.55167651/0.7500000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.54623073/0.7600000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.54158473/0.7500000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53774118/0.7500000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53470063/0.7600000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53246087/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53101641/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53035825/0.7300000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53046054/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53101140/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53165370/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53219223/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53253436/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53265208/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53255659/0.7400000\n",
      "####Few Shot 860 | 972 ####, loss/acc = 0.53228360/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0383, device='cuda:1'), 0.8, 0.75)\n",
      "=====> Optimized weights: tensor([-1.2811, -1.4664, -1.2417, -1.2667, -1.3607, -1.4678, -1.3479, -1.4036,\n",
      "        -0.9051, -1.2372, -1.2376, -1.4579, -1.2514,  1.3406,  1.3699, -1.3410,\n",
      "         1.3604, -1.3464, -1.4910,  1.5234], device='cuda:1')\n",
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.7, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.57161945/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.56289941/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.55519080/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.54850388/0.7500000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.54284686/0.7500000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53822434/0.7500000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53463739/0.7600000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53208220/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53055173/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53003776/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53037703/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53112757/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53194624/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53263563/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53309798/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53329867/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53324378/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53296500/0.7400000\n",
      "####Few Shot 880 | 972 ####, loss/acc = 0.53250921/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1007, device='cuda:1'), 0.9, 0.875)\n",
      "=====> Optimized weights: tensor([-1.1787, -0.7757, -1.3619, -1.2187,  1.3165, -0.8951,  1.2843, -1.2951,\n",
      "        -0.8549, -1.1024, -0.9276,  1.1973, -1.2548,  1.3638, -1.1373,  1.2451,\n",
      "         1.3219,  1.3277, -0.9970,  1.4177], device='cuda:1')\n",
      "=====> init acc: (tensor(0.7000, device='cuda:1'), 0.9, 0.85)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.57122129/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.56218374/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.55424064/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.54740232/0.7500000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.54167479/0.7500000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53706080/0.7500000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53355902/0.7500000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53116399/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.52986550/0.7500000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.52964967/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53015006/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53082275/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53138304/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53170478/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53175646/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53156233/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53117925/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53068185/0.7400000\n",
      "####Few Shot 900 | 972 ####, loss/acc = 0.53015333/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.4084, device='cuda:1'), 0.8, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([ 1.2730, -0.9152, -1.1211, -0.8887,  1.2938,  1.1109, -0.7440, -0.9067,\n",
      "         1.3185, -0.7881,  1.1849, -0.9278, -0.9541,  1.2807, -0.9092, -0.8980,\n",
      "        -0.9170, -0.7718, -0.9889, -1.1107], device='cuda:1')\n",
      "=====> init acc: (tensor(0., device='cuda:1'), 0.4, 0.5)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.57150477/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.56268358/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.55488658/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.54812384/0.7500000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.54240435/0.7500000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53773558/0.7500000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53412318/0.7500000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53157037/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53007615/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.52963215/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.52996248/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53053373/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53101844/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53127652/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53127694/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53105104/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53066534/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.53020465/0.7400000\n",
      "####Few Shot 920 | 972 ####, loss/acc = 0.52976292/0.7400000\n",
      "=====> Optimized acc: (tensor(0.1441, device='cuda:1'), 0.6, 0.5)\n",
      "=====> Optimized weights: tensor([ 0.9372, -0.6160, -1.1959, -0.6949,  1.1211, -1.0998, -1.2804, -0.5512,\n",
      "        -0.9617,  1.0639, -0.7874,  1.2749,  0.9436, -0.7824,  0.8211, -1.2897,\n",
      "        -0.8836,  0.9734, -1.0965,  0.5693], device='cuda:1')\n",
      "=====> init acc: (tensor(0.7000, device='cuda:1'), 0.9, 0.85)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.58133960/0.7300000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.56927389/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.55884719/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.55008036/0.7500000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.54298776/0.7500000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53757548/0.7500000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53384185/0.7500000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53177667/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53135461/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53203321/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53298217/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53375167/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53415489/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53415620/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53380412/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53319377/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53244394/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53168374/0.7400000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 940 | 972 ####, loss/acc = 0.53104424/0.7400000\n",
      "####Few Shot 940 | 972 ####, loss/acc = 0.53064901/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.4355, device='cuda:1'), 0.7, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([ 0.9785, -0.7002, -0.2748, -0.8787, -0.7807, -0.6491, -0.2018, -0.4823,\n",
      "         0.9694, -0.3532,  1.0970, -0.8464, -0.7763,  0.9950, -0.8187, -0.4682,\n",
      "         0.8878, -0.7506, -0.3744,  0.9687], device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1226, device='cuda:1'), 0.6, 0.5)\n",
      "=====> init weights: tensor([ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,\n",
      "         0.0000,  0.0000,  0.0000,  0.0000, -0.6339, -0.4885,  1.0466, -0.7215,\n",
      "        -0.7290, -0.9396, -0.6172,  1.0730], device='cuda:1')\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53545129/0.7600000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53244472/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53073627/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53032130/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53053391/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53062797/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53050864/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53028673/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53012252/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53012991/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53017783/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53014505/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.53002965/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.52989227/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.52981335/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.52979094/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.52974945/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.52966475/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.52956200/0.7400000\n",
      "####Few Shot 960 | 972 ####, loss/acc = 0.52948707/0.7500000\n",
      "=====> Optimized acc: (tensor(0.0693, device='cuda:1'), 0.6, 0.6)\n",
      "=====> Optimized weights: tensor([ 0.0278, -0.5183,  0.0305, -1.1661,  0.7518,  0.1091, -0.4000,  0.4582,\n",
      "         0.9276, -0.0577, -0.6842,  0.5464, -1.1479,  0.3803,  1.2791, -0.4555,\n",
      "        -0.9784, -1.8071, -0.1451,  1.7641], device='cuda:1')\n"
     ]
    }
   ],
   "source": [
    "tmp = (DVA.lr4model, DVA.scale_lr4model)\n",
    "DVA.lr4model, DVA.scale_lr4model = 1e-1, 5e-4\n",
    "exp_idxs, valid_idxs = DVA.ValidIndicesOut(max_epochs=1, max_meta_steps=20, lr4weights=0.1) # ferguson 上是0.1, sydney上是0.05\n",
    "DVA.lr4model, DVA.scale_lr4model = tmp[0], tmp[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "    def ModelTrain(self, max_epoch, valid_indices):\n",
    "        for epoch in range(max_epoch):\n",
    "            start = 0\n",
    "            sum_loss = 0.\n",
    "            for batch in self.balancedTrainingIter(valid_indices):\n",
    "                loss = self.InnerLoss(batch, self.model)\n",
    "                cost = torch.mean(loss)\n",
    "                self.model.zero_grad()\n",
    "                self.model_optim.zero_grad()\n",
    "                cost.backward()\n",
    "                self.model_optim.step()\n",
    "                torch.cuda.empty_cache()\n",
    "                print('####Model Update (%3d | %3d) ####, loss = %6.8f' % (\n",
    "                    start, len(valid_indices), loss.data.mean()\n",
    "                ))\n",
    "                sum_loss += cost.data\n",
    "                start += self.batch_size\n",
    "            mean_loss = (sum_loss*1.0)/((len(valid_indices)//self.batch_size)+1)\n",
    "            print(\"mean loss:\", mean_loss)\n",
    "            if mean_loss <0.2: # early stop\n",
    "                break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "exp_idxs, valid_idxs, pseaudo_idxs = [527,588,182,693,355,798,209,879,373,846,438,253,603,599,125,724,892,230,119,969,414,286,68,496,320,213,199,877,261,917,449,670,407,480,204,45,324,545,202,754,120,484,391,421,453,925,297,870,357,626,456,869,158,186,78,248,422,768,108,636,720,582,73,611,468,615,160,661,371,840,931,123,647,663,702,639,539,701,217,685,3,965,232,886,49,675,330,604,310,816,173,641,428,951,513,412,372,577],[809,195,372,527,402,736,940,588,431,81,25,182,721,727,742,693,50,9,260,355,587,531,649,798,14,128,83,209,562,732,814,879,826,295,801,373,383,843,863,846,109,834,637,438,934,537,772,253,17,593,140,603,163,4,646,599,623,29,555,125,551,920,928,724,857,19,892,230,836,443,415,119,490,676,835,969,16,406,99,414,425,156,567,286,589,137,212,68,855,193,542,496,72,184,111,320,318,308,607,213,296,828,199,712,576,878,877,265,602,319,261,766,298,704,917,170,89,20,449,356,959,41,670,352,233,442,407,905,825,367,480,88,54,498,204,950,756,810,45,360,74,715,324,710,645,900,545,145,660,333,202,524,85,813,754,102,107,272,120,711,960,787,484,366,247,305,391,485,854,600,421,606,175,114,453,628,515,820,925,658,379,842,297,871,957,595,870,235,219,698,357,806,761,501,626,210,350,262,456,671,927,124,869,243,581,429,158,667,654,821,186,345,644,342,78,325,848,921,248,358,84,423,422,617,494,876,768,398,141,108,203,817,346,636,726,221,267,720,706,640,856,582,799,46,280,73,605,64,532,611,520,470,332,468,728,795,783,615,31,573,70,160,831,739,703,661,24,448,509,371,767,648,525,840,146,392,695,931,758,938,526,123,393,387,647,483,897,375,663,105,632,686,702,762,683,226,639,165,166,287,539,898,337,516,701,343,217,651,106,793,685,419,52,77,3,561,884,518,965,457,385,222,232,11,778,473,886,405,376,115,49,592,569,868,675,53,71,478,330,568,949,424,604,246,126,190,310,699,556,968,816,714,169,231,173,708,508,790,641,269,719,808,428,933,517,575,951,454,511,149,513,682,797,666,412,540,354,809,372,159,940,472,577],[9,60,76,82,343,378,383,477,480,482,485,503,512,516,518,542,545,555,579,581,588,595,607,619,626,646,666,676,678,680,697,736,758,762,766,792,794,796,798,835,846,849,859,882,885,892,926,928,960,970]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.\n",
      "  warnings.warn(warning.format(ret))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Model Update (  0 | 433) ####, loss = 0.12064435\n",
      "####Model Update ( 20 | 433) ####, loss = 0.11959308\n",
      "####Model Update ( 40 | 433) ####, loss = 0.16586164\n",
      "####Model Update ( 60 | 433) ####, loss = 0.10303869\n",
      "####Model Update ( 80 | 433) ####, loss = 0.27036369\n",
      "####Model Update (100 | 433) ####, loss = 0.26365551\n",
      "####Model Update (120 | 433) ####, loss = 0.23993349\n",
      "####Model Update (140 | 433) ####, loss = 0.32983947\n",
      "####Model Update (160 | 433) ####, loss = 0.39930019\n",
      "####Model Update (180 | 433) ####, loss = 0.30061623\n",
      "####Model Update (200 | 433) ####, loss = 0.28480884\n",
      "####Model Update (220 | 433) ####, loss = 0.23979595\n",
      "####Model Update (240 | 433) ####, loss = 0.21546499\n",
      "####Model Update (260 | 433) ####, loss = 0.29273701\n",
      "####Model Update (280 | 433) ####, loss = 0.32457829\n",
      "####Model Update (300 | 433) ####, loss = 0.28161737\n",
      "####Model Update (320 | 433) ####, loss = 0.23793414\n",
      "####Model Update (340 | 433) ####, loss = 0.27635118\n",
      "####Model Update (360 | 433) ####, loss = 0.24047303\n",
      "####Model Update (380 | 433) ####, loss = 0.18605524\n",
      "####Model Update (400 | 433) ####, loss = 0.18941256\n",
      "####Model Update (420 | 433) ####, loss = 0.34458309\n",
      "####Model Update (440 | 433) ####, loss = 0.36263022\n",
      "####Model Update (460 | 433) ####, loss = 0.22697659\n",
      "mean loss: tensor(0.2735, device='cuda:0')\n"
     ]
    }
   ],
   "source": [
    "ModelTrain(DVA, 1, pseaudo_idxs+valid_idxs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "98\n",
      "tensor(0.4844, device='cuda:0') tensor(0.4198, device='cuda:0')\n",
      "0.8084112149532711 0.6697530864197531\n",
      "(array([0.63103953, 0.76124567]), array([0.862     , 0.46610169]), array([0.72865596, 0.5781866 ]), array([500, 472]))\n",
      "(array([0.825     , 0.78723404]), array([0.83193277, 0.77894737]), array([0.82845188, 0.78306878]), array([238, 190]))\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(len(DVA.weak_set))\n",
    "pos_indices = valid_idxs+pseaudo_idxs#DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = DVA.weak_set_label, torch.tensor(DVA.weak_set.data_y).argmax(dim=1)\n",
    "print(len(exp_idxs))\n",
    "print(entrophy.mean(), entrophy[pos_indices].mean())\n",
    "print(accuracy_score(labels[pos_indices], preds[pos_indices]), accuracy_score(labels, preds))\n",
    "print(precision_recall_fscore_support(labels, preds))\n",
    "print(precision_recall_fscore_support(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "98\n",
      "tensor(0.4844, device='cuda:0') tensor(0.4638, device='cuda:0')\n",
      "0.8015873015873016 0.6697530864197531\n",
      "(array([0.63103953, 0.76124567]), array([0.862     , 0.46610169]), array([0.72865596, 0.5781866 ]), array([500, 472]))\n",
      "(array([0.80612245, 0.7967033 ]), array([0.81025641, 0.79234973]), array([0.80818414, 0.79452055]), array([195, 183]))\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(len(DVA.weak_set))\n",
    "pos_indices = valid_idxs#DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = DVA.weak_set_label, torch.tensor(DVA.weak_set.data_y).argmax(dim=1)\n",
    "print(len(exp_idxs))\n",
    "print(entrophy.mean(), entrophy[pos_indices].mean())\n",
    "print(accuracy_score(labels[pos_indices], preds[pos_indices]), accuracy_score(labels, preds))\n",
    "print(precision_recall_fscore_support(labels, preds))\n",
    "print(precision_recall_fscore_support(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "e_arr = WeakLabeling(model2, unlabeled_set)\n",
    "#     few_shot_set = NewFewShotSet(model1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "DVA = MetaSelfTrainer(model1, unlabeled_set, Convert_2_BiGCNFormat(few_shot_set),\n",
    "                       new_domain_label, convey_fn=None, lr4model=5e-2,\n",
    "                       scale_lr4model=4e-2, batch_size=20, expand_cnt=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "DVA.ConstructExpandData(expand_domain, list(range(len(expand_domain))), \n",
    "                        batch_size=100, convey_fn=Convert_2_BiGCNFormat)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.6, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.\n",
      "  warnings.warn(warning.format(ret))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot   0 | 972 ####, loss/acc = 0.61469287/0.6900000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.60438365/0.6900000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.59578085/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58890134/0.7200000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58375430/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58034140/0.6900000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57865733/0.7000000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57868153/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57966650/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58073771/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58149678/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58180857/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58167750/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58118248/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.58044004/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57958370/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57875234/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57808143/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57769436/0.7100000\n",
      "####Few Shot   0 | 972 ####, loss/acc = 0.57766008/0.7000000\n",
      "=====> Optimized acc: (tensor(0.4171, device='cuda:1'), 0.9, 0.875)\n",
      "=====> Optimized weights: tensor([-0.1923,  1.0375,  0.8957, -0.4725, -0.8226, -0.6287, -0.2360,  0.5470,\n",
      "        -0.1917, -0.4826,  1.1244, -0.2294,  0.8081, -0.3839,  0.6622, -0.7385,\n",
      "        -0.4810,  0.7793, -0.3760,  0.8507], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.6, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.61469287/0.6900000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.60662878/0.7000000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.59956610/0.7000000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.59351313/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58847719/0.7200000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58446187/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58146721/0.7000000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57948798/0.6900000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57851291/0.7000000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57851678/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57909209/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57975572/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58026761/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58053154/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58053327/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.58030593/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57990938/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57941729/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57891065/0.7100000\n",
      "####Few Shot  20 | 972 ####, loss/acc = 0.57847196/0.7100000\n",
      "=====> Optimized acc: (tensor(-0.0100, device='cuda:1'), 0.7, 0.7)\n",
      "=====> Optimized weights: tensor([ 0.8261,  1.1440, -0.9419, -0.7477,  1.0741, -1.1256,  0.9944,  0.8876,\n",
      "        -0.7205, -0.7887,  1.0918,  0.9314, -0.7452,  0.9720, -1.0467,  0.5873,\n",
      "        -1.1085, -0.6385, -0.6379,  1.0897], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.9, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.61469287/0.6900000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.60784632/0.7000000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.60170519/0.7000000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.59627420/0.7000000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.59155816/0.7200000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.58756042/0.7200000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.58428252/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.58172154/0.7000000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57987624/0.6800000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57874227/0.6900000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57831621/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57849073/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57891864/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57934254/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57963353/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57974231/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57966685/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57943445/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57908720/0.7100000\n",
      "####Few Shot  40 | 972 ####, loss/acc = 0.57867688/0.7100000\n",
      "=====> Optimized acc: (tensor(0.4431, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-0.8573, -0.9182, -0.9764, -1.0143, -0.8998,  1.3071,  1.4629, -1.5774,\n",
      "         1.6152, -0.7919, -1.1959,  1.1240, -1.0672,  1.3647, -0.8061,  1.2237,\n",
      "        -1.0456, -0.9794, -1.1060, -1.4902], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.8, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.61469287/0.6900000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.60505348/0.6900000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.59691203/0.7000000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.59028256/0.7200000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58517218/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58157808/0.6900000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.57949156/0.6900000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.57889098/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.57937241/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58017612/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58086073/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58123899/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58126616/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58097696/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.58044964/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.57978451/0.7100000\n",
      "####Few Shot  60 | 972 ####, loss/acc = 0.57909197/0.7100000\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-22-2d0c64f036ca>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mtmp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1e-1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m5e-4\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mexp_idxs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalid_idxs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mValidIndicesOut\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mDVA\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_epochs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_meta_steps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m20\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlr4weights\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.1\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# ferguson 上是0.1, sydney上是0.05\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      4\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtmp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m<ipython-input-20-62b36fe532b3>\u001b[0m in \u001b[0;36mValidIndicesOut\u001b[0;34m(self, max_epochs, max_meta_steps, lr4weights)\u001b[0m\n\u001b[1;32m     17\u001b[0m             \u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindices\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSampleBatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindices\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     18\u001b[0m             self.OptimizeWeights(step, batch, indices, lr4weights, few_shot_data,\n\u001b[0;32m---> 19\u001b[0;31m                                  tmp_model_device, max_meta_steps=max_meta_steps)\n\u001b[0m\u001b[1;32m     20\u001b[0m             \u001b[0mpos_weak_labels\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mweak_labels\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mindices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__eq__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     21\u001b[0m             \u001b[0mneg_weak_labels\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mweak_labels\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mindices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__eq__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m<ipython-input-17-bb04971ab5c5>\u001b[0m in \u001b[0;36mOptimizeWeights\u001b[0;34m(self, step, batch, indices, lr4weights, few_shot_data, device, tmp_model, max_meta_steps)\u001b[0m\n\u001b[1;32m     35\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mmeta_step\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmax_meta_steps\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     36\u001b[0m             \u001b[0mweights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mto_var\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzeros\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbatch_size\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtmp_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 37\u001b[0;31m             \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mComputeGrads4Weights\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mweights\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfew_shot_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     38\u001b[0m \u001b[0;31m#             print(\"grad_weights:\", grad_weights)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     39\u001b[0m             \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgrad_weights\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mgrad_weights\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnorm\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/InstanceReweighting.py\u001b[0m in \u001b[0;36mComputeGrads4Weights\u001b[0;34m(self, step, batch, weights, tmp_model, few_shot_data)\u001b[0m\n\u001b[1;32m    259\u001b[0m         \u001b[0mmodel_grads\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mModelGrads\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mweights\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    260\u001b[0m         \u001b[0mupdate_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtmp_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msource_params\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmodel_grads\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 261\u001b[0;31m         \u001b[0mloss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0macc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRDMLoss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfew_shot_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    262\u001b[0m         print('####Few Shot %3d | %3d ####, loss/acc = %6.8f/%6.7f' % (\n\u001b[1;32m    263\u001b[0m             \u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweak_set_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mloss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0macc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mRDMLoss\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    215\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    216\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mRDMLoss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 217\u001b[0;31m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    218\u001b[0m         \u001b[0mepsilon\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mones\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevice\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;36m1e-8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    219\u001b[0m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0mepsilon\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# to avoid the prediction [1.0, 0.0], which leads to the 'nan' value in log operation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    210\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    211\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 212\u001b[0;31m         \u001b[0mseq_outs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mBatch2Vecs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    213\u001b[0m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrdm_cls\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mseq_outs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msoftmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdim\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    214\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mpreds\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mBatch2Vecs\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    205\u001b[0m         \u001b[0mall_sents\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0msent\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0msents\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mseqs\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0msent\u001b[0m \u001b[0;32min\u001b[0m \u001b[0msents\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    206\u001b[0m         \u001b[0;31m# inputs = [self.sent2vec(sents) for sents in seqs]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 207\u001b[0;31m         \u001b[0minputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msent2vec\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mall_sents\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    208\u001b[0m         \u001b[0mseq_outs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprop_model\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mTD_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBU_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    209\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mseq_outs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, *input, **kwargs)\u001b[0m\n\u001b[1;32m    530\u001b[0m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_slow_forward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    531\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 532\u001b[0;31m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    533\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mhook\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_forward_hooks\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    534\u001b[0m             \u001b[0mhook_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhook\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/SentModel/Sent2Vec.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, sents)\u001b[0m\n\u001b[1;32m     87\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msents\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     88\u001b[0m         tfidf_arr = torch.tensor(self.vectorizer.transform(sents).toarray(),\n\u001b[0;32m---> 89\u001b[0;31m                                  dtype=torch.float32, device=self.device)\n\u001b[0m\u001b[1;32m     90\u001b[0m         \u001b[0msort_vals\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msort_idxs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtfidf_arr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msort\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdim\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     91\u001b[0m         \u001b[0mtoken_ids\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msort_idxs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtop_K\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "tmp = (DVA.lr4model, DVA.scale_lr4model)\n",
    "DVA.lr4model, DVA.scale_lr4model = 1e-1, 5e-4\n",
    "exp_idxs, valid_idxs = ValidIndicesOut(DVA, max_epochs=1, max_meta_steps=20, lr4weights=0.1) # ferguson 上是0.1, sydney上是0.05\n",
    "DVA.lr4model, DVA.scale_lr4model = tmp[0], tmp[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.6000, device='cuda:1'), 0.9, 0.8)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.\n",
      "  warnings.warn(warning.format(ret))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot   0 | 500 ####, loss/acc = 0.61469287/0.6900000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.65112287/0.6500000\n",
      "grad_weights:  tensor([-15.8289,  -5.6610,  -6.3057,   3.3419,   2.8862,  -2.3079, -11.4365,\n",
      "         -4.8764, -13.2815,   2.2722,   1.7666,   3.4514,   9.8932,   1.7370,\n",
      "          0.3717,   6.9175,  15.2553,   3.5962,   0.7395,   0.4592],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.66233176/0.6600000\n",
      "grad_weights:  tensor([-33.6040, -12.2782, -13.3928,   7.2235,   6.2150,  -4.6818, -24.3312,\n",
      "        -10.7324, -27.2155,   4.8297,   3.9127,   7.0759,  21.1915,   3.6555,\n",
      "          0.7483,  15.0350,  31.4167,   7.6332,   1.5881,   0.9984],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.75453562/0.6200000\n",
      "grad_weights:  tensor([-44.7953, -15.9980, -16.8987,   9.4199,   7.9992,  -6.1393, -32.5882,\n",
      "        -13.9647, -34.8730,   6.2577,   5.0352,   9.2804,  27.0180,   4.8405,\n",
      "          0.9849,  19.4895,  42.2573,   9.8090,   2.0091,   1.3246],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.68293905/0.7100000\n",
      "grad_weights:  tensor([-30.2455, -11.5817, -12.5625,   6.4936,   5.6177,  -4.6614, -21.1526,\n",
      "         -9.8013, -25.7672,   4.4886,   3.4718,   6.4576,  18.9957,   3.2963,\n",
      "          0.7648,  13.9049,  27.4952,   7.1614,   1.4373,   0.9193],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.56562018/0.6944444\n",
      "final grad_weights:  tensor([-20.3722,  -7.7139,  -8.3950,   4.2389,   3.7487,  -3.1030, -14.0468,\n",
      "         -6.5920, -16.9582,   3.0173,   2.2820,   4.2306,  12.6683,   2.1488,\n",
      "          0.4922,   9.2163,  17.9811,   4.5731,   0.9476,   0.6027],\n",
      "       device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.60548687/0.6900000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64634424/0.6400000\n",
      "grad_weights:  tensor([-10.4194,  -3.4999,  -4.1511,   2.4563,   2.1964,  -1.6559,  -7.5772,\n",
      "         -3.0577,  -8.8200,   1.7116,   1.3206,   2.5927,   7.2557,   1.4291,\n",
      "          0.2808,   5.0539,  11.5004,   2.7854,   0.5457,   0.3542],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.65112358/0.6600000\n",
      "grad_weights:  tensor([-28.2031,  -9.7395, -11.0984,   6.7595,   6.0046,  -4.1036, -20.5209,\n",
      "         -8.6710, -22.6299,   4.6042,   3.7431,   6.6110,  19.6219,   3.8086,\n",
      "          0.6767,  14.0545,  29.7101,   7.5046,   1.4776,   0.9969],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.73955488/0.6300000\n",
      "grad_weights:  tensor([-39.4391, -13.3034, -14.6266,   9.2209,   8.0794,  -5.6302, -28.7923,\n",
      "        -11.8226, -30.3043,   6.2454,   5.0342,   9.0635,  26.1412,   5.2777,\n",
      "          0.9306,  19.0660,  41.8161,  10.0905,   1.9503,   1.3870],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.67268538/0.7100000\n",
      "grad_weights:  tensor([-25.6865,  -9.3353, -10.5609,   6.1404,   5.4871,  -4.1785, -17.9839,\n",
      "         -8.0201, -21.7440,   4.3411,   3.3502,   6.1048,  17.7740,   3.4701,\n",
      "          0.7075,  13.1832,  26.2076,   7.1457,   1.3511,   0.9309],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.55910462/0.7083333\n",
      "final grad_weights:  tensor([-15.8025,  -5.6833,  -6.4804,   3.6356,   3.3466,  -2.5666, -10.8614,\n",
      "         -4.9281, -13.0968,   2.6723,   1.9948,   3.6548,  10.8162,   2.0608,\n",
      "          0.4200,   7.9673,  15.5883,   4.1314,   0.8109,   0.5548],\n",
      "       device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.59768033/0.7000000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64327151/0.6300000\n",
      "grad_weights:  tensor([-5.4027, -1.6882, -2.2150,  1.4351,  1.3368, -1.0081, -3.9780, -1.4879,\n",
      "        -4.7707,  1.0342,  0.7788,  1.6110,  4.2855,  0.9433,  0.1853,  2.9049,\n",
      "         7.0309,  1.7212,  0.3267,  0.2098], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64129037/0.6600000\n",
      "grad_weights:  tensor([-23.1175,  -7.5546,  -9.0129,   6.2023,   5.6867,  -3.5326, -16.9392,\n",
      "         -6.8570, -18.4018,   4.3021,   3.5128,   6.0610,  17.7957,   3.8887,\n",
      "          0.6020,  12.8631,  27.4553,   7.2251,   1.3501,   0.9755],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.72572660/0.6300000\n",
      "grad_weights:  tensor([-34.3390, -10.9528, -12.5444,   8.9532,   8.0912,  -5.1280, -25.1917,\n",
      "         -9.9173, -26.0443,   6.1825,   4.9932,   8.7828,  25.0561,   5.7045,\n",
      "          0.8738,  18.4802,  40.8984,  10.2827,   1.8792,   1.4413],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.66356951/0.7000000\n",
      "grad_weights:  tensor([-21.3700,  -7.3897,  -8.7309,   5.7074,   5.2678,  -3.6996, -14.9905,\n",
      "         -6.4449, -18.0079,   4.1305,   3.1773,   5.6783,  16.3311,   3.5883,\n",
      "          0.6473,  12.2824,  24.4500,   7.0088,   1.2503,   0.9271],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.55391091/0.6805556\n",
      "final grad_weights:  tensor([-11.5232,  -3.9524,  -4.7438,   2.9296,   2.8209,  -2.0333,  -7.8755,\n",
      "         -3.4738,  -9.5548,   2.2407,   1.6360,   2.9865,   8.7016,   1.8609,\n",
      "          0.3441,   6.4957,  12.6613,   3.5072,   0.6548,   0.4807],\n",
      "       device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.59128785/0.7200000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64193511/0.6200000\n",
      "grad_weights:  tensor([-0.8157, -0.1925, -0.4916,  0.2780,  0.2914, -0.3659, -0.6676, -0.1484,\n",
      "        -1.1524,  0.2276,  0.1361,  0.5045,  1.0082,  0.2288,  0.0856,  0.4600,\n",
      "         1.8769,  0.3740,  0.0828,  0.0180], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.63284945/0.6500000\n",
      "grad_weights:  tensor([-18.4009,  -5.6975,  -7.1333,   5.5508,   5.2504,  -2.9716, -13.6074,\n",
      "         -5.2776, -14.5511,   3.9172,   3.2152,   5.4244,  15.7250,   3.8683,\n",
      "          0.5243,  11.4628,  24.6651,   6.7738,   1.2049,   0.9299],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.71306753/0.6300000\n",
      "grad_weights:  tensor([-29.5295,  -8.9190, -10.6478,   8.6161,   8.0211,  -4.6338, -21.7964,\n",
      "         -8.2338, -22.1084,   6.0622,   4.9062,   8.4313,  23.7592,   6.1016,\n",
      "          0.8147,  17.7232,  39.4853,  10.3668,   1.7949,   1.4841],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.65561312/0.7000000\n",
      "grad_weights:  tensor([-17.3265,  -5.7202,  -7.0686,   5.1897,   4.9457,  -3.2253, -12.1841,\n",
      "         -5.0621, -14.5772,   3.8485,   2.9464,   5.1738,  14.6619,   3.6259,\n",
      "          0.5842,  11.1923,  22.2169,   6.7267,   1.1335,   0.9037],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.55006373/0.6944444\n",
      "final grad_weights:  tensor([-7.5768, -2.4981, -3.1890,  2.1185,  2.1577, -1.5055, -5.1103, -2.2196,\n",
      "        -6.3539,  1.7146,  1.1996,  2.2243,  6.3344,  1.5166,  0.2649,  4.7978,\n",
      "         9.2093,  2.6761,  0.4790,  0.3751], device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.58631951/0.7100000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64235604/0.6200000\n",
      "grad_weights:  tensor([ 3.2977,  1.0161,  1.0221, -1.0291, -0.9651,  0.2673,  2.3373,  0.9754,\n",
      "         2.0222, -0.7174, -0.6225, -0.7380, -2.5919, -0.7671, -0.0181, -2.2778,\n",
      "        -3.9393, -1.3016, -0.1894, -0.2303], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.62581086/0.6500000\n",
      "grad_weights:  tensor([-14.0821,  -4.1389,  -5.4570,   4.8002,   4.6851,  -2.4233, -10.5433,\n",
      "         -3.9175, -11.0951,   3.4437,   2.8467,   4.7003,  13.4240,   3.7092,\n",
      "          0.4443,   9.8508,  21.3614,   6.1277,   1.0424,   0.8547],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.70159346/0.6300000\n",
      "grad_weights:  tensor([-25.0282,  -7.1697,  -8.9263,   8.1918,   7.8568,  -4.1458, -18.6192,\n",
      "         -6.7524, -18.5015,   5.8743,   4.7651,   8.0066,  22.2415,   6.4375,\n",
      "          0.7529,  16.7801,  37.5957,  10.3148,   1.6959,   1.5110],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64883691/0.7000000\n",
      "grad_weights:  tensor([-13.5848,  -4.3021,  -5.5700,   4.5794,   4.5077,  -2.7566,  -9.5779,\n",
      "         -3.8585, -11.4617,   3.4873,   2.6504,   4.5867,  12.7687,   3.5466,\n",
      "          0.5182,   9.9069,  19.5229,   6.2742,   0.9999,   0.8556],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.54758114/0.7222222\n",
      "final grad_weights:  tensor([-3.9925, -1.2943, -1.8015,  1.1947,  1.3427, -0.9842, -2.5801, -1.1474,\n",
      "        -3.5005,  1.0855,  0.6767,  1.3614,  3.7144,  0.9831,  0.1822,  2.8711,\n",
      "         5.2574,  1.6050,  0.2819,  0.2313], device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.58277810/0.7000000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64454287/0.6300000\n",
      "grad_weights:  tensor([  6.9045,   1.9677,   2.3301,  -2.4812,  -2.4417,   0.8875,   5.0179,\n",
      "          1.8992,   4.7460,  -1.8076,  -1.5010,  -2.1107,  -6.4743,  -2.1083,\n",
      "         -0.1251,  -5.2968, -10.3506,  -3.3275,  -0.4888,  -0.5444],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.62017912/0.6900000\n",
      "grad_weights:  tensor([-10.1676,  -2.8427,  -3.9680,   3.9403,   3.9700,  -1.8864,  -7.7435,\n",
      "         -2.7528,  -8.0249,   2.8703,   2.3948,   3.8797,  10.8776,   3.3776,\n",
      "          0.3614,   8.0177,  17.5451,   5.2498,   0.8595,   0.7427],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.69131911/0.6500000\n",
      "grad_weights:  tensor([-20.8711,  -5.6814,  -7.3788,   7.6832,   7.5869,  -3.6675, -15.6742,\n",
      "         -5.4616, -15.2383,   5.6148,   4.5661,   7.5053,  20.5146,   6.6977,\n",
      "          0.6888,  15.6533,  35.1978,  10.1074,   1.5820,   1.5178],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64325666/0.6900000\n",
      "grad_weights:  tensor([-10.1679,  -3.1106,  -4.2295,   3.8734,   3.9406,  -2.2947,  -7.1827,\n",
      "         -2.8203,  -8.6662,   3.0394,   2.2828,   3.9140,  10.6569,   3.3254,\n",
      "          0.4493,   8.4228,  16.3580,   5.6261,   0.8484,   0.7771],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.54647374/0.7222222\n",
      "final grad_weights:  tensor([-0.7912, -0.3143, -0.5838,  0.1564,  0.3620, -0.4730, -0.2935, -0.2447,\n",
      "        -1.0053,  0.3461,  0.0608,  0.3976,  0.8558,  0.2213,  0.0964,  0.7166,\n",
      "         0.8254,  0.2731,  0.0629,  0.0420], device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.58066159/0.6800000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.64848703/0.6500000\n",
      "grad_weights:  tensor([  9.9911,   2.6937,   3.4418,  -4.0771,  -4.1503,   1.4914,   7.3668,\n",
      "          2.6418,   7.0276,  -3.0491,  -2.5056,  -3.6114, -10.6096,  -3.8603,\n",
      "         -0.2351,  -8.5823, -17.2813,  -5.7284,  -0.8155,  -0.9347],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.61595422/0.6800000\n",
      "grad_weights:  tensor([-6.6829, -1.7790, -2.6633,  2.9774,  3.0988, -1.3646, -5.2223, -1.7689,\n",
      "        -5.3363,  2.1933,  1.8579,  2.9669,  8.1238,  2.8276,  0.2764,  5.9776,\n",
      "        13.2800,  4.1275,  0.6576,  0.5876], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.68225402/0.6600000\n",
      "grad_weights:  tensor([-17.0714,  -4.4237,  -5.9949,   7.0858,   7.1979,  -3.1991, -12.9644,\n",
      "         -4.3434, -12.3130,   5.2754,   4.3018,   6.9235,  18.5821,   6.8400,\n",
      "          0.6224,  14.3391,  32.3310,   9.7215,   1.4521,   1.4988],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.63888067/0.6900000\n",
      "grad_weights:  tensor([-7.0997, -2.1230, -3.0449,  3.0729,  3.2312, -1.8432, -5.0029, -1.9365,\n",
      "        -6.1993,  2.5011,  1.8398,  3.1521,  8.3449,  2.9151,  0.3783,  6.7498,\n",
      "        12.7639,  4.7634,  0.6796,  0.6627], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.54674363/0.7777778\n",
      "final grad_weights:  tensor([ 2.0174,  0.4702,  0.4747, -0.9970, -0.7970,  0.0278,  1.7431,  0.5056,\n",
      "         1.1433, -0.5123, -0.6548, -0.6680, -2.2263, -0.8221,  0.0078, -1.6610,\n",
      "        -4.0333, -1.3467, -0.1784, -0.2010], device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.57995868/0.7000000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.65416372/0.6400000\n",
      "grad_weights:  tensor([ 12.5340,   3.2262,   4.3682,  -5.8122,  -6.0987,   2.0758,   9.3837,\n",
      "          3.2221,   8.8853,  -4.4460,  -3.6409,  -5.2355, -14.9616,  -6.0914,\n",
      "         -0.3474, -12.1129, -24.6426,  -8.5220,  -1.1690,  -1.4122],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.61312389/0.6900000\n",
      "grad_weights:  tensor([-3.6158, -0.9197, -1.5307,  1.9106,  2.0621, -0.8594, -2.9792, -0.9473,\n",
      "        -3.0196,  1.4078,  1.2304,  1.9629,  5.1793,  2.0109,  0.1895,  3.7398,\n",
      "         8.6215,  2.7399,  0.4361,  0.3820], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.67440301/0.6500000\n",
      "grad_weights:  tensor([-13.6100,  -3.3726,  -4.7678,   6.3991,   6.6808,  -2.7421, -10.4975,\n",
      "         -3.3833,  -9.7230,   4.8514,   3.9676,   6.2617,  16.4610,   6.8267,\n",
      "          0.5539,  12.8439,  29.0438,   9.1338,   1.3062,   1.4487],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.63571388/0.7100000\n",
      "grad_weights:  tensor([-4.3510, -1.3084, -1.9978,  2.1668,  2.3674, -1.3982, -3.0404, -1.1847,\n",
      "        -4.0313,  1.8573,  1.3087,  2.2998,  5.8223,  2.2692,  0.3041,  4.8706,\n",
      "         8.7751,  3.6523,  0.4902,  0.5030], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.54838300/0.7777778\n",
      "final grad_weights:  tensor([ 4.4162,  1.0830,  1.3832, -2.2665, -2.1436,  0.5159,  3.5306,  1.1174,\n",
      "         2.9581, -1.4937, -1.4763, -1.8348, -5.5080, -2.2013, -0.0836, -4.2489,\n",
      "        -9.2661, -3.2739, -0.4426, -0.5061], device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.58064455/0.7100000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.66151178/0.6200000\n",
      "grad_weights:  tensor([ 14.5961,   3.5950,   5.1233,  -7.6790,  -8.2873,   2.6378,  11.0742,\n",
      "          3.6600,  10.3468,  -5.9981,  -4.9089,  -6.9748, -19.4889,  -8.8643,\n",
      "         -0.4614, -15.8594, -32.3337, -11.7150,  -1.5488,  -1.9874],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.61166847/0.7100000\n",
      "grad_weights:  tensor([-1.0000, -0.2374, -0.5600,  0.7397,  0.8513, -0.3731, -1.0140, -0.2710,\n",
      "        -1.0585,  0.5116,  0.5063,  0.8686,  2.0625,  0.8812,  0.1012,  1.3218,\n",
      "         3.6425,  1.0684,  0.1943,  0.1185], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.66777831/0.6500000\n",
      "grad_weights:  tensor([-10.5688,  -2.5018,  -3.6885,   5.6212,   6.0224,  -2.2982,  -8.2741,\n",
      "         -2.5655,  -7.4561,   4.3364,   3.5578,   5.5175,  14.1613,   6.6124,\n",
      "          0.4838,  11.1716,  25.3770,   8.3237,   1.1432,   1.3604],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.63375670/0.7000000\n",
      "grad_weights:  tensor([-1.9717, -0.6496, -1.0872,  1.1611,  1.3426, -0.9647, -1.2991, -0.5566,\n",
      "        -2.1670,  1.1085,  0.6889,  1.3595,  3.1237,  1.3412,  0.2279,  2.8079,\n",
      "         4.4498,  2.2831,  0.2815,  0.2919], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.55136287/0.7638889\n",
      "final grad_weights:  tensor([  6.4317,   1.5487,   2.1493,  -3.6468,  -3.6819,   0.9879,   5.0705,\n",
      "          1.6061,   4.4536,  -2.6005,  -2.4061,  -3.0982,  -8.9601,  -3.9680,\n",
      "         -0.1769,  -7.0284, -14.8022,  -5.5185,  -0.7292,  -0.8821],\n",
      "       device='cuda:1')\n",
      "####Few Shot   0 | 500 ####, loss/acc = 0.58190894/0.7100000\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.66757423/0.6100000\n",
      "grad_weights:  tensor([ 15.7494,   3.7692,   5.5544,  -9.0480,  -9.9508,   3.0140,  12.0662,\n",
      "          3.8903,  11.1453,  -7.1686,  -5.8678,  -8.2476, -22.7171, -11.1421,\n",
      "         -0.5413, -18.5752, -37.8222, -14.1688,  -1.8273,  -2.4507],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.61144567/0.7200000\n",
      "grad_weights:  tensor([ 0.5771,  0.1474,  0.0271, -0.1279, -0.0899, -0.0468,  0.1959,  0.1232,\n",
      "         0.1096, -0.1773, -0.0514,  0.0615, -0.1778, -0.1145,  0.0392, -0.4553,\n",
      "         0.0260, -0.2564,  0.0159, -0.1030], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.66388351/0.6500000\n",
      "grad_weights:  tensor([-8.6667, -1.9878, -3.0168,  5.0245,  5.4775, -1.9967, -6.8656, -2.0709,\n",
      "        -6.0562,  3.9211,  3.2245,  4.9512, 12.4634,  6.3168,  0.4339,  9.9052,\n",
      "        22.6240,  7.6206,  1.0196,  1.2723], device='cuda:1')\n",
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.63308614/0.7000000\n",
      "grad_weights:  tensor([-0.5163, -0.2710, -0.5286,  0.4039,  0.5313, -0.6705, -0.2148, -0.1850,\n",
      "        -1.0385,  0.5236,  0.2034,  0.6542,  1.1526,  0.5037,  0.1737,  1.2706,\n",
      "         1.2711,  1.1708,  0.1247,  0.1103], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Expand Few Shot    0 | 500 ####, loss/acc = 0.55419791/0.7777778\n",
      "final grad_weights:  tensor([  7.6175,   1.7990,   2.6059,  -4.6715,  -4.8693,   1.3070,   6.0039,\n",
      "          1.8825,   5.3197,  -3.4471,  -3.1191,  -4.0331, -11.4523,  -5.4533,\n",
      "         -0.2429,  -9.0691, -18.8019,  -7.2728,  -0.9419,  -1.1907],\n",
      "       device='cuda:1')\n",
      "=====> Optimized acc: (tensor(-0.2957, device='cuda:1'), 0.8, 0.7142857142857143)\n",
      "=====> Optimized weights: tensor([ 0.8989,  0.8946,  0.9208, -0.8912, -0.9035,  0.9610,  0.8968,  0.8950,\n",
      "         0.9183, -0.9087, -0.8801, -0.9311, -0.9057, -0.8782, -0.9714, -0.9047,\n",
      "        -0.9126, -0.8938, -0.9099, -0.8643], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.7, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.61469287/0.6900000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.65112287/0.6500000\n",
      "grad_weights:  tensor([ -5.1085,  18.0827,   8.2194,   1.4119, -10.2582, -20.0707,   1.9670,\n",
      "          0.3455,  -1.7196,  15.7857,  -8.8606, -14.2151,   8.0893,   8.0722,\n",
      "          1.5525,   7.4724,  -7.2511,   3.0525,   1.5522,   2.2064],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.66233176/0.6600000\n",
      "grad_weights:  tensor([-10.4352,  37.4161,  17.4767,   2.9832, -19.9475, -41.8753,   4.3221,\n",
      "          0.7097,  -3.7648,  33.5385, -17.3977, -31.4714,  17.7474,  17.5786,\n",
      "          3.3293,  16.3229, -15.6056,   6.8335,   3.4243,   4.6852],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.75453562/0.6200000\n",
      "grad_weights:  tensor([-13.3889,  47.3677,  21.5963,   3.9364, -25.7264, -54.3256,   5.5785,\n",
      "          0.9323,  -4.8300,  42.7139, -22.1026, -40.9252,  22.9473,  22.6179,\n",
      "          4.2149,  20.3425, -20.0538,   8.7950,   4.3489,   5.9585],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.68293905/0.7100000\n",
      "grad_weights:  tensor([-10.3705,  34.8720,  16.2168,   2.7546, -19.2873, -37.8177,   3.8162,\n",
      "          0.7160,  -3.5045,  30.7020, -16.8796, -29.0543,  15.9154,  16.0863,\n",
      "          2.9758,  14.8867, -14.8368,   6.1027,   3.0653,   4.1928],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.56562018/0.6944444\n",
      "final grad_weights:  tensor([ -6.7085,  23.1168,  10.8056,   1.8290, -13.0072, -25.3167,   2.5005,\n",
      "          0.4512,  -2.2977,  20.6970, -11.1732, -19.0237,  10.5622,  10.8573,\n",
      "          1.9366,   9.8528,  -9.9259,   3.9471,   2.0114,   2.7705],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.60292047/0.7000000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.64520967/0.6400000\n",
      "grad_weights:  tensor([ -3.2963,  11.7512,   5.2857,   0.9204,  -6.5987, -11.5184,   1.3110,\n",
      "          0.2339,  -0.9941,  10.8236,  -5.7737,  -8.4025,   5.4557,   5.3508,\n",
      "          1.0293,   4.7495,  -4.3038,   1.9020,   1.0054,   1.6171],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.64810103/0.6600000\n",
      "grad_weights:  tensor([ -8.8713,  32.9426,  15.2521,   2.7207, -16.5514, -32.6476,   4.0403,\n",
      "          0.6206,  -3.0426,  31.5314, -14.5737, -26.1921,  16.9982,  16.2753,\n",
      "          3.0207,  14.4295, -12.7864,   6.0396,   3.1010,   4.6969],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.73580843/0.6300000\n",
      "grad_weights:  tensor([-12.0474,  44.3231,  19.9446,   3.8272, -22.6723, -44.9965,   5.5376,\n",
      "          0.8630,  -4.1427,  42.6385, -19.5879, -36.1792,  23.3751,  22.2552,\n",
      "          4.0435,  19.0753, -17.4508,   8.2503,   4.1750,   6.3359],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.66966611/0.7100000\n",
      "grad_weights:  tensor([ -9.0339,  31.2598,  14.3694,   2.5564, -16.3772, -29.8911,   3.6005,\n",
      "          0.6435,  -2.8816,  29.2843, -14.4247, -24.5554,  15.4315,  15.1227,\n",
      "          2.7268,  13.3731, -12.4007,   5.4520,   2.8037,   4.2493],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.55725771/0.6944444\n",
      "final grad_weights:  tensor([ -5.2480,  18.3517,   8.5080,   1.4986,  -9.9481, -17.7734,   2.0597,\n",
      "          0.3619,  -1.6724,  17.5215,  -8.6029, -14.1787,   8.9956,   9.0584,\n",
      "          1.5575,   7.8459,  -7.3951,   3.0660,   1.6131,   2.4670],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.59342372/0.7100000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.64204431/0.6200000\n",
      "grad_weights:  tensor([-1.4781,  4.7879,  2.1565,  0.3304, -3.0582, -4.0886,  0.4900,  0.1158,\n",
      "        -0.3257,  4.4482, -2.7713, -2.7301,  1.9062,  2.0030,  0.4223,  1.7611,\n",
      "        -1.5085,  0.6305,  0.3705,  0.7227], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.63612145/0.6500000\n",
      "grad_weights:  tensor([ -7.3185,  27.9547,  12.8856,   2.3940, -13.2843, -24.3750,   3.6505,\n",
      "          0.5272,  -2.3785,  28.3998, -11.8412, -21.0415,  15.6231,  14.5115,\n",
      "          2.6549,  12.4303, -10.1168,   5.1605,   2.7169,   4.5453],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.71892214/0.6400000\n",
      "grad_weights:  tensor([-10.7149,  40.8195,  18.1763,   3.6720, -19.7147, -36.4438,   5.4236,\n",
      "          0.7906,  -3.5077,  41.6390, -17.1388, -31.5266,  23.3588,  21.5392,\n",
      "          3.8298,  17.7582, -14.9729,   7.6392,   3.9571,   6.6382],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.65828329/0.7100000\n",
      "grad_weights:  tensor([ -7.6969,  27.1775,  12.3841,   2.3028, -13.5578, -22.7307,   3.2915,\n",
      "          0.5671,  -2.3053,  26.8917, -12.0302, -20.1375,  14.4167,  13.7612,\n",
      "          2.4270,  11.7230, -10.0780,   4.7244,   2.4885,   4.1711],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.55108982/0.6805556\n",
      "final grad_weights:  tensor([ -3.7810,  13.0513,   6.0446,   1.0968,  -6.9804, -11.1094,   1.4932,\n",
      "          0.2676,  -1.0960,  13.2153,  -6.0901,  -9.4456,   6.7383,   6.7686,\n",
      "          1.1147,   5.5902,  -4.9916,   2.0913,   1.1471,   1.9475],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.58622843/0.7100000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.64168656/0.6300000\n",
      "grad_weights:  tensor([ 0.3258, -2.6981, -1.1402, -0.3621,  0.3080,  2.0737, -0.5112, -0.0077,\n",
      "         0.2817, -3.2596,  0.1105,  2.7060, -2.6114, -1.9766, -0.2687, -1.5295,\n",
      "         1.0944, -0.7518, -0.3530, -0.5432], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.62642491/0.6500000\n",
      "grad_weights:  tensor([ -5.7889,  22.5431,  10.4059,   1.9992, -10.1754, -17.1841,   3.1413,\n",
      "          0.4300,  -1.7728,  24.1523,  -9.2182, -16.0729,  13.5613,  12.2806,\n",
      "          2.2296,  10.2081,  -7.6208,   4.1971,   2.2690,   4.1817],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.70390558/0.6300000\n",
      "grad_weights:  tensor([ -9.3938,  36.8998,  16.2930,   3.4660, -16.8654, -28.7668,   5.2246,\n",
      "          0.7148,  -2.9235,  39.6591, -14.7691, -26.9911,  22.8120,  20.4379,\n",
      "          3.5702,  16.2414, -12.6348,   6.9591,   3.6906,   6.8249],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.64883363/0.7000000\n",
      "grad_weights:  tensor([ -6.3635,  22.6556,  10.2654,   1.9879, -10.8425, -16.4273,   2.8748,\n",
      "          0.4865,  -1.7746,  23.4907,  -9.7077, -15.8358,  12.7950,  11.9713,\n",
      "          2.0723,   9.8479,  -7.8843,   3.9178,   2.1153,   3.9117],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.54716629/0.7222222\n",
      "final grad_weights:  tensor([-2.3191,  7.2893,  3.4318,  0.6178, -4.1421, -5.4357,  0.7850,  0.1685,\n",
      "        -0.5681,  7.7900, -3.6639, -4.8707,  3.7276,  3.9698,  0.6039,  3.0763,\n",
      "        -2.7365,  1.0229,  0.6088,  1.1531], device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.58134574/0.6900000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.64416564/0.6300000\n",
      "grad_weights:  tensor([  2.1017, -10.6107,  -4.5785,  -1.1614,   3.4683,   6.9425,  -1.7084,\n",
      "         -0.1356,   0.8276, -12.1897,   2.8452,   7.8367,  -8.1310,  -6.5814,\n",
      "         -1.0458,  -5.1001,   3.4858,  -2.2394,  -1.1670,  -2.2583],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.61902106/0.6800000\n",
      "grad_weights:  tensor([ -4.2851,  16.7487,   7.8049,   1.5308,  -7.2405, -11.1197,   2.4981,\n",
      "          0.3297,  -1.2245,  18.8485,  -6.7201, -11.3470,  10.7597,   9.5614,\n",
      "          1.7434,   7.7523,  -5.3091,   3.1573,   1.7575,   3.5532],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.69078326/0.6500000\n",
      "grad_weights:  tensor([ -8.0904,  32.6115,  14.3050,   3.2055, -14.1537, -22.0725,   4.9283,\n",
      "          0.6360,  -2.3901,  36.7236, -12.4893, -22.6220,  21.6858,  18.9312,\n",
      "          3.2631,  14.5293, -10.4460,   6.2142,   3.3749,   6.8611],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.64135396/0.6900000\n",
      "grad_weights:  tensor([ -5.0372,  17.7425,   8.0193,   1.6057,  -8.2462, -11.0394,   2.3365,\n",
      "          0.4019,  -1.2885,  19.0987,  -7.4679, -11.6876,  10.5060,   9.7355,\n",
      "          1.6588,   7.7495,  -5.8262,   3.0317,   1.6805,   3.4188],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.54552197/0.7500000\n",
      "final grad_weights:  tensor([-0.8711,  1.1331,  0.6854,  0.0558, -1.4547, -0.7842, -0.0788,  0.0650,\n",
      "        -0.0886,  1.3010, -1.3416, -0.5072, -0.0831,  0.6538,  0.0227,  0.3160,\n",
      "        -0.6429, -0.1359, -0.0042,  0.0208], device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.57877564/0.6900000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.64948243/0.6600000\n",
      "grad_weights:  tensor([  3.8336, -18.8356,  -8.1243,  -2.0710,   6.3901,  10.5535,  -3.1130,\n",
      "         -0.2673,   1.3115, -22.1596,   5.4048,  12.5904, -14.6379, -11.7762,\n",
      "         -1.9081,  -8.9135,   5.6471,  -3.8216,  -2.0704,  -4.4996],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.61391336/0.6800000\n",
      "grad_weights:  tensor([-2.8175, 10.6573,  5.1132,  0.9861, -4.5039, -6.1789,  1.7101,  0.2267,\n",
      "        -0.7323, 12.5912, -4.3628, -6.9050,  7.2017,  6.3672,  1.1951,  5.0918,\n",
      "        -3.1917,  2.0442,  1.1803,  2.6016], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.67956889/0.6600000\n",
      "grad_weights:  tensor([ -6.8080,  27.9965,  12.2189,   2.8825, -11.5758, -16.3539,   4.5228,\n",
      "          0.5538,  -1.9031,  32.8444, -10.3084, -18.4323,  19.9080,  17.0098,\n",
      "          2.9025,  12.6257,  -8.4039,   5.3992,   3.0039,   6.6886],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.63586867/0.7100000\n",
      "grad_weights:  tensor([-3.7258, 12.5055,  5.6699,  1.1520, -5.7876, -6.5735,  1.6660,  0.3140,\n",
      "        -0.8470, 13.7936, -5.3247, -7.7399,  7.5229,  7.0562,  1.1853,  5.4490,\n",
      "        -3.9173,  2.0708,  1.1826,  2.6329], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.54617572/0.7777778\n",
      "final grad_weights:  tensor([ 0.5536, -5.3508, -2.1787, -0.5943,  1.0645,  2.8644, -1.1121, -0.0423,\n",
      "         0.3428, -6.1412,  0.8609,  3.5947, -4.7106, -3.1692, -0.6315, -2.6751,\n",
      "         1.2791, -1.3817, -0.6945, -1.5189], device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.57851386/0.7100000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.65761220/0.6300000\n",
      "grad_weights:  tensor([  5.5093, -27.2665, -11.7458,  -3.1189,   9.0500,  13.0542,  -4.7365,\n",
      "         -0.4019,   1.7350, -32.9681,   7.7708,  16.9106, -22.0790, -17.5168,\n",
      "         -2.8555, -12.9380,   7.5681,  -5.4899,  -3.0632,  -7.3462],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.61108506/0.7000000\n",
      "grad_weights:  tensor([-1.3932,  4.3402,  2.3485,  0.3585, -1.9721, -2.2690,  0.7660,  0.1211,\n",
      "        -0.2926,  5.4862, -2.1580, -2.7715,  2.8812,  2.7165,  0.5821,  2.2451,\n",
      "        -1.2670,  0.8588,  0.5347,  1.2604], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.67027330/0.6400000\n",
      "grad_weights:  tensor([ -5.5459,  23.0939,  10.0351,   2.5034,  -9.1434, -11.5907,   3.9925,\n",
      "          0.4685,  -1.4604,  28.0815,  -8.2343, -14.4477,  17.4432,  14.6591,\n",
      "          2.4856,  10.5303,  -6.5094,   4.5135,   2.5734,   6.2492],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.63239467/0.7000000\n",
      "grad_weights:  tensor([-2.4312,  6.9441,  3.2057,  0.6136, -3.4717, -2.9808,  0.8428,  0.2218,\n",
      "        -0.4451,  7.6160, -3.2872, -4.0002,  3.7956,  3.9139,  0.6444,  2.9329,\n",
      "        -2.1507,  1.0280,  0.6136,  1.4868], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.54913110/0.7500000\n",
      "final grad_weights:  tensor([  1.9494, -12.0933,  -5.1413,  -1.3522,   3.3971,   5.5939,  -2.3284,\n",
      "         -0.1532,   0.7275, -14.4094,   2.9317,   7.3972, -10.1417,  -7.4828,\n",
      "         -1.3598,  -5.8783,   3.0226,  -2.7098,  -1.4636,  -3.5372],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.57957846/0.7100000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.66466379/0.6200000\n",
      "grad_weights:  tensor([  6.6083, -33.0605, -14.2343,  -3.8856,  10.6943,  14.1407,  -5.9646,\n",
      "         -0.4946,   1.9891, -40.6734,   9.2541,  19.5777, -27.6102, -21.6937,\n",
      "         -3.5458, -15.7704,   8.7326,  -6.6646,  -3.7863,  -9.6583],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.61042303/0.7100000\n",
      "grad_weights:  tensor([-0.4536, -0.0418,  0.4394, -0.1227, -0.3617, -0.1571,  0.0312,  0.0474,\n",
      "        -0.0211,  0.2107, -0.7509, -0.1373, -0.5001, -0.0069,  0.1251,  0.2183,\n",
      "        -0.0617,  0.0083,  0.0523,  0.0842], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.66500717/0.6500000\n",
      "grad_weights:  tensor([ -4.7054,  19.6307,   8.5148,   2.1964,  -7.5789,  -8.8704,   3.5562,\n",
      "          0.4090,  -1.1848,  24.4102,  -6.8853, -11.8841,  15.3802,  12.8295,\n",
      "          2.1703,   9.0144,  -5.3131,   3.8756,   2.2478,   5.7699],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.63110769/0.7000000\n",
      "grad_weights:  tensor([-1.5645,  3.0327,  1.4806,  0.1993, -1.9888, -1.0144,  0.1923,  0.1573,\n",
      "        -0.1954,  2.9892, -1.9661, -1.6019,  0.8541,  1.5280,  0.2388,  1.1154,\n",
      "        -1.0369,  0.2772,  0.1870,  0.4716], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.55238003/0.7916667\n",
      "final grad_weights:  tensor([  2.8763, -16.7881,  -7.2008,  -1.9160,   4.8666,   6.9529,  -3.2635,\n",
      "         -0.2303,   0.9628, -20.4154,   4.2542,   9.7887, -14.2611, -10.6729,\n",
      "         -1.8975,  -8.1632,   4.1015,  -3.6564,  -2.0309,  -5.2147],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.58070105/0.7100000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.66955495/0.6200000\n",
      "grad_weights:  tensor([  7.2618, -36.6106, -15.7603,  -4.3804,  11.6292,  14.5955,  -6.7639,\n",
      "         -0.5517,   2.1314, -45.4857,  10.1051,  21.0957, -31.1561, -24.3417,\n",
      "         -3.9846, -17.5323,   9.3878,  -7.3963,  -4.2337, -11.2291],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.61050600/0.7200000\n",
      "grad_weights:  tensor([ 1.0754e-01, -2.7398e+00, -7.3486e-01, -4.3300e-01,  5.6052e-01,\n",
      "         9.1729e-01, -4.5483e-01,  2.4885e-03,  1.3208e-01, -3.1094e+00,\n",
      "         6.8728e-02,  1.3725e+00, -2.6965e+00, -1.7578e+00, -1.6563e-01,\n",
      "        -1.0514e+00,  6.2164e-01, -5.1887e-01, -2.5126e-01, -7.3565e-01],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.66219676/0.6500000\n",
      "grad_weights:  tensor([ -4.1994,  17.4746,   7.5673,   1.9928,  -6.6591,  -7.4049,   3.2565,\n",
      "          0.3722,  -1.0259,  22.0154,  -6.0877, -10.3786,  13.9725,  11.6236,\n",
      "          1.9643,   8.0508,  -4.6186,   3.4706,   2.0329,   5.3966],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.63073367/0.6900000\n",
      "grad_weights:  tensor([-1.0408,  0.5926,  0.4073, -0.0738, -1.1195,  0.0137, -0.2432,  0.1171,\n",
      "        -0.0518,  0.0087, -1.1868, -0.1980, -1.1007, -0.0274, -0.0242, -0.0361,\n",
      "        -0.3915, -0.1981, -0.0872, -0.2538], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.55483848/0.7916667\n",
      "final grad_weights:  tensor([  3.4320, -19.6919,  -8.4747,  -2.2836,   5.7157,   7.6073,  -3.8784,\n",
      "         -0.2782,   1.0969, -24.2201,   5.0241,  11.1732, -16.9407, -12.7212,\n",
      "         -2.2428,  -9.5983,   4.7199,  -4.2507,  -2.3923,  -6.3706],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 500 ####, loss/acc = 0.58136374/0.7100000\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.67215270/0.6200000\n",
      "grad_weights:  tensor([  7.5714, -38.3939, -16.5253,  -4.6378,  12.0788,  14.7698,  -7.1769,\n",
      "         -0.5807,   2.2000, -47.9440,  10.5131,  21.8343, -32.9867, -25.6955,\n",
      "         -4.2110, -18.4216,   9.7038,  -7.7691,  -4.4703, -12.0668],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.61066866/0.7200000\n",
      "grad_weights:  tensor([ 0.3890, -4.1013, -1.3269, -0.5945,  1.0088,  1.4028, -0.7095, -0.0202,\n",
      "         0.2059, -4.8102,  0.4692,  2.1068, -3.8405, -2.6615, -0.3156, -1.6977,\n",
      "         0.9520, -0.7871, -0.4090, -1.1798], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.66087425/0.6500000\n",
      "grad_weights:  tensor([-3.9460, 16.3760,  7.0862,  1.8850, -6.2044, -6.7180,  3.0953,  0.3535,\n",
      "        -0.9486, 20.7653, -5.6912, -9.6387, 13.2166, 10.9895,  1.8564,  7.5543,\n",
      "        -4.2786,  3.2625,  1.9215,  5.1818], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.63062471/0.6900000\n",
      "grad_weights:  tensor([-0.7555, -0.6458, -0.1374, -0.2169, -0.6936,  0.4829, -0.4730,  0.0967,\n",
      "         0.0179, -1.5285, -0.8031,  0.4891, -2.1257, -0.8356, -0.1608, -0.6263,\n",
      "        -0.0770, -0.4415, -0.2308, -0.6496], device='cuda:1')\n",
      "####Expand Few Shot   20 | 500 ####, loss/acc = 0.55617481/0.7916667\n",
      "final grad_weights:  tensor([  3.7095, -21.1599,  -9.1162,  -2.4742,   6.1270,   7.8881,  -4.1976,\n",
      "         -0.3025,   1.1612, -26.1572,   5.3993,  11.8432, -18.3225, -13.7726,\n",
      "         -2.4202, -10.3263,   5.0169,  -4.5520,  -2.5792,  -6.9880],\n",
      "       device='cuda:1')\n",
      "=====> Optimized acc: (tensor(0.0705, device='cuda:1'), 0.9, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([ 0.8870, -0.7070, -0.7291, -0.6184,  0.8608,  0.7787, -0.6015, -0.9019,\n",
      "         0.7531, -0.6900,  0.8859,  0.7415, -0.5821, -0.6768, -0.6692, -0.6705,\n",
      "         0.7824, -0.6287, -0.6486, -0.5964], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.7, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  40 | 500 ####, loss/acc = 0.61469287/0.6900000\n",
      "####Expand Few Shot   40 | 500 ####, loss/acc = 0.65112287/0.6500000\n",
      "grad_weights:  tensor([ 4.0197, 16.9510, -4.9749, -4.6949,  1.2899,  9.6183, -4.4905,  0.1662,\n",
      "         5.8222,  0.4224,  5.9281, -3.8648, -1.5531,  2.1137, -4.6435,  0.8760,\n",
      "        13.7101,  7.4790, -4.4738,  3.1248], device='cuda:1')\n",
      "####Expand Few Shot   40 | 500 ####, loss/acc = 0.66233176/0.6600000\n",
      "grad_weights:  tensor([ 8.4880, 36.9982, -9.1681, -9.5493,  2.7587, 20.4108, -9.1737,  0.3056,\n",
      "        12.3543,  0.7460, 13.2956, -7.9361, -3.1886,  4.5123, -9.9938,  1.8129,\n",
      "        28.1448, 15.8912, -9.2199,  6.5595], device='cuda:1')\n",
      "####Expand Few Shot   40 | 500 ####, loss/acc = 0.75453562/0.6200000\n",
      "grad_weights:  tensor([ 10.9642,  48.3659, -12.0702, -12.0543,   3.5395,  25.7578, -11.6552,\n",
      "          0.4045,  15.9888,   0.9618,  17.0116, -10.1867,  -4.2476,   5.8594,\n",
      "        -12.7865,   2.5024,  35.9465,  20.7234, -11.7164,   8.6324],\n",
      "       device='cuda:1')\n",
      "####Expand Few Shot   40 | 500 ####, loss/acc = 0.68293905/0.7100000\n",
      "grad_weights:  tensor([ 7.6518, 33.6718, -9.3495, -9.4650,  2.5873, 18.5951, -8.7024,  0.3205,\n",
      "        11.7795,  0.7556, 12.0764, -7.7399, -2.9359,  4.2021, -9.5127,  1.5492,\n",
      "        25.2400, 14.4018, -8.7333,  6.0812], device='cuda:1')\n",
      "####Expand Few Shot   40 | 500 ####, loss/acc = 0.56562018/0.6944444\n",
      "final grad_weights:  tensor([ 5.1051, 22.3806, -6.0801, -6.1613,  1.7301, 12.3622, -5.8395,  0.2007,\n",
      "         7.9686,  0.4949,  8.0394, -5.1589, -1.9498,  2.7995, -6.3184,  0.9812,\n",
      "        16.9136,  9.6180, -5.8799,  4.0251], device='cuda:1')\n",
      "####Few Shot  40 | 500 ####, loss/acc = 0.60638815/0.6900000\n",
      "####Expand Few Shot   40 | 500 ####, loss/acc = 0.64674073/0.6400000\n",
      "grad_weights:  tensor([ 3.1445, 13.0802, -3.9643, -3.4891,  1.0450,  7.7233, -3.2602,  0.1362,\n",
      "         4.4823,  0.3511,  4.7288, -2.8942, -1.0891,  1.6469, -3.4258,  0.7204,\n",
      "        11.0914,  6.0370, -3.0790,  2.4373], device='cuda:1')\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-20-ae43aa25299a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mtmp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1e-1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m5e-4\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mexp_idxs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEvaluate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmax_epochs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_meta_steps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlr4weights\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.1\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# ferguson 上是0.1, sydney上是0.05\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      4\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtmp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m<ipython-input-16-bb04971ab5c5>\u001b[0m in \u001b[0;36mEvaluate\u001b[0;34m(self, max_epochs, max_meta_steps, lr4weights)\u001b[0m\n\u001b[1;32m     76\u001b[0m                 \u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindices\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSampleBatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindices\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     77\u001b[0m                 self.OptimizeWeights(step, batch, indices, lr4weights, few_shot_data,\n\u001b[0;32m---> 78\u001b[0;31m                                      tmp_model_device, max_meta_steps=max_meta_steps)\n\u001b[0m\u001b[1;32m     79\u001b[0m                 \u001b[0mpos_weak_labels\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mweak_labels\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mindices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__eq__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     80\u001b[0m                 \u001b[0mneg_weak_labels\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mweak_labels\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mindices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__eq__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m<ipython-input-16-bb04971ab5c5>\u001b[0m in \u001b[0;36mOptimizeWeights\u001b[0;34m(self, step, batch, indices, lr4weights, few_shot_data, device, tmp_model, max_meta_steps)\u001b[0m\n\u001b[1;32m     35\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mmeta_step\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmax_meta_steps\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     36\u001b[0m             \u001b[0mweights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mto_var\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzeros\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbatch_size\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtmp_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 37\u001b[0;31m             \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mComputeGrads4Weights\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mweights\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfew_shot_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     38\u001b[0m \u001b[0;31m#             print(\"grad_weights:\", grad_weights)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     39\u001b[0m             \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgrad_weights\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mgrad_weights\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnorm\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/InstanceReweighting.py\u001b[0m in \u001b[0;36mComputeGrads4Weights\u001b[0;34m(self, step, batch, weights, tmp_model, few_shot_data)\u001b[0m\n\u001b[1;32m    266\u001b[0m             \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautograd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgrad\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mloss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mweights\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0monly_inputs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mretain_graph\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    267\u001b[0m             \u001b[0;32mfor\u001b[0m \u001b[0mbatch_idx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexpand_data\u001b[0m \u001b[0;32min\u001b[0m \u001b[0menumerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpand_data_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 268\u001b[0;31m                 \u001b[0me_loss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0me_acc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRDMLoss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexpand_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    269\u001b[0m                 print('####Expand Few Shot  %3d | %3d ####, loss/acc = %6.8f/%6.7f' % (\n\u001b[1;32m    270\u001b[0m                     \u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweak_set\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0me_loss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0me_acc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mRDMLoss\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    215\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    216\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mRDMLoss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 217\u001b[0;31m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    218\u001b[0m         \u001b[0mepsilon\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mones\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevice\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;36m1e-8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    219\u001b[0m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0mepsilon\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# to avoid the prediction [1.0, 0.0], which leads to the 'nan' value in log operation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    210\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    211\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 212\u001b[0;31m         \u001b[0mseq_outs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mBatch2Vecs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    213\u001b[0m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrdm_cls\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mseq_outs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msoftmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdim\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    214\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mpreds\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mBatch2Vecs\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    206\u001b[0m         \u001b[0;31m# inputs = [self.sent2vec(sents) for sents in seqs]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    207\u001b[0m         \u001b[0minputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msent2vec\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mall_sents\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 208\u001b[0;31m         \u001b[0mseq_outs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprop_model\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mTD_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBU_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    209\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mseq_outs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    210\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, *input, **kwargs)\u001b[0m\n\u001b[1;32m    530\u001b[0m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_slow_forward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    531\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 532\u001b[0;31m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    533\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mhook\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_forward_hooks\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    534\u001b[0m             \u001b[0mhook_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhook\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/PropModel/GraphPropagation.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, TD_graphs, BU_graphs, inputs)\u001b[0m\n\u001b[1;32m    466\u001b[0m         \u001b[0mbig_g_TD\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdgl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mTD_graphs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    467\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 468\u001b[0;31m         \u001b[0mh_TD\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgcn_layer1_TD\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbig_g_TD\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    469\u001b[0m         \u001b[0mh_TD\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mF\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrelu\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mh_TD\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    470\u001b[0m         H_TD_inputs = torch.cat([torch.cat([h_TD[r_idx:r_idx + num_nodes[i]],\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, *input, **kwargs)\u001b[0m\n\u001b[1;32m    530\u001b[0m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_slow_forward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    531\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 532\u001b[0;31m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    533\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mhook\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_forward_hooks\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    534\u001b[0m             \u001b[0mhook_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhook\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/PropModel/GraphPropagation.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, graph, feat)\u001b[0m\n\u001b[1;32m    105\u001b[0m             \u001b[0mThe\u001b[0m \u001b[0moutput\u001b[0m \u001b[0mfeature\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    106\u001b[0m         \"\"\"\n\u001b[0;32m--> 107\u001b[0;31m         \u001b[0mA\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madjacency_matrix\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_dense\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfeat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    108\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_norm\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    109\u001b[0m             \u001b[0mnorm\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0min_degrees\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfloat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0;36m0.5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "tmp = (DVA.lr4model, DVA.scale_lr4model)\n",
    "DVA.lr4model, DVA.scale_lr4model = 1e-1, 5e-4\n",
    "exp_idxs = DVA.Evaluate(max_epochs=1, max_meta_steps=10, lr4weights=0.1) # ferguson 上是0.1, sydney上是0.05\n",
    "DVA.lr4model, DVA.scale_lr4model = tmp[0], tmp[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "50\n",
      "tensor(0.4911, device='cuda:0') tensor(0.5561, device='cuda:0')\n",
      "0.76\n",
      "0.76\n",
      "0.76\n",
      "0.76\n",
      "labels: tensor([1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0,\n",
      "        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0,\n",
      "        1, 0])\n",
      "preds: tensor([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,\n",
      "        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,\n",
      "        1, 0])\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = exp_idxs#DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(exp_idxs))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(accuracy_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(\"labels:\", labels[pos_indices])\n",
    "print(\"preds:\", preds[pos_indices])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "98\n",
      "tensor(0.4917, device='cuda:0') tensor(0.5544, device='cuda:0')\n",
      "0.7857142857142857\n",
      "0.7755102040816326\n",
      "0.7916666666666666\n",
      "0.7835051546391752\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = exp_idxs#DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(exp_idxs))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(accuracy_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "500\n",
      "tensor(170)\n",
      "(tensor(0.4160), 0.668, 0.708)\n",
      "(tensor(0.0246), 0.768, 0.8235294117647058)\n",
      "tensor(0.4911, device='cuda:0') tensor(0.5561, device='cuda:0')\n",
      "0.8235294117647058 0.8235294117647058\n",
      "0.546875 0.6363636363636364\n",
      "0.6572769953051643 0.717948717948718\n",
      "labels: tensor([0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0,\n",
      "        0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,\n",
      "        1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0,\n",
      "        0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0,\n",
      "        1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1,\n",
      "        0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,\n",
      "        1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0,\n",
      "        1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0,\n",
      "        1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1,\n",
      "        1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1,\n",
      "        1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0,\n",
      "        0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1,\n",
      "        0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1,\n",
      "        1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1,\n",
      "        1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0,\n",
      "        0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1,\n",
      "        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0])\n",
      "preds: tensor([1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,\n",
      "        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
      "        0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0,\n",
      "        0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,\n",
      "        1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
      "        1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,\n",
      "        0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,\n",
      "        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,\n",
      "        0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
      "        0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,\n",
      "        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,\n",
      "        0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
      "        1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,\n",
      "        0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,\n",
      "        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = valid_idxs\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(\"labels:\", labels[pos_indices])\n",
    "print(\"preds:\", preds[pos_indices])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "500\n",
      "tensor(170)\n",
      "(tensor(0.4160), 0.668, 0.708)\n",
      "(tensor(0.0246), 0.768, 0.8235294117647058)\n",
      "tensor(0.4911, device='cuda:0') tensor(0.5561, device='cuda:0')\n",
      "0.8235294117647058 0.8235294117647058\n",
      "0.546875 1.0\n",
      "0.6572769953051643 0.9032258064516129\n",
      "labels: tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1,\n",
      "        1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0,\n",
      "        1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,\n",
      "        1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1,\n",
      "        1, 1])\n",
      "preds: tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
      "        1, 1])\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(\"labels:\", labels[pos_indices])\n",
    "print(\"preds:\", preds[pos_indices])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "972\n",
      "tensor(207180)\n",
      "(tensor(0.4033), 0.5637860082304527, 0.7016460905349794)\n",
      "(tensor(-0.0262), 0.7551440329218106, 0.7660818713450293)\n",
      "tensor(0.4917, device='cuda:0') tensor(0.5349, device='cuda:0')\n",
      "0.7676470588235295 0.7676470588235295\n",
      "0.5529661016949152 0.867109634551495\n",
      "0.6428571428571429 0.8143525741029642\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "# pos_indices = DVA.weak_set_weights.__gt__(-1e-3)\n",
    "pos_indices = DVA.weak_set_weights.argsort()[-DVA.weak_set_size//2:]\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(pos_indices.int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[pos_indices].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "972\n",
      "486\n",
      "(tensor(0.4033), 0.5637860082304527, 0.7016460905349794)\n",
      "(tensor(-0.0277), 0.7366255144032922, 0.7676470588235295)\n",
      "tensor(0.4917, device='cuda:0') tensor(0.5304, device='cuda:0')\n",
      "0.7676470588235295 0.7676470588235295\n",
      "0.5529661016949152 0.8419354838709677\n",
      "0.6428571428571429 0.8030769230769231\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "# pos_indices = DVA.weak_set_weights.__gt__(-1e-3)\n",
    "pos_indices = DVA.weak_set_weights.argsort()[-DVA.weak_set_size//2:]\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(len(pos_indices))\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[pos_indices].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "972\n",
      "tensor(340)\n",
      "(tensor(0.4033), 0.5637860082304527, 0.7016460905349794)\n",
      "(tensor(-0.0277), 0.7366255144032922, 0.7676470588235295)\n",
      "tensor(0.4917, device='cuda:0') tensor(0.5544, device='cuda:0')\n",
      "0.7676470588235295 0.7676470588235295\n",
      "0.5529661016949152 1.0\n",
      "0.6428571428571429 0.8685524126455908\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "972\n",
      "tensor(632)\n",
      "(tensor(0.4033), 0.5637860082304527, 0.7016460905349794)\n",
      "(tensor(0.0286), 0.6358024691358025, 0.6661392405063291)\n",
      "tensor(0.4917, device='cuda:0') tensor(0.4580, device='cuda:0')\n",
      "0.7676470588235295 0.0\n",
      "0.5529661016949152 0.0\n",
      "0.6428571428571429 0.0\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/sklearn/metrics/classification.py:1437: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 due to no predicted samples.\n",
      "  'precision', 'predicted', average, warn_for)\n",
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/sklearn/metrics/classification.py:1437: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 due to no predicted samples.\n",
      "  'precision', 'predicted', average, warn_for)\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "972\n",
      "tensor(895)\n",
      "(tensor(0.4033), 0.5637860082304527, 0.7016460905349794)\n",
      "(tensor(0.4288), 0.7263374485596708, 0.7072625698324022)\n",
      "tensor(0.4917, device='cuda:0') tensor(0.4836, device='cuda:0')\n",
      "0.7676470588235295 0.7773851590106007\n",
      "0.5529661016949152 0.5250596658711217\n",
      "0.6428571428571429 0.6267806267806268\n"
     ]
    }
   ],
   "source": [
    "# 使用Adam, 使用挑选出来的200个数据\n",
    "# 使用SGD基本没法训练\n",
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "972\n",
      "tensor(376)\n",
      "(tensor(0.4033), 0.5637860082304527, 0.7016460905349794)\n",
      "(tensor(0.1985), 0.8004115226337448, 0.7845744680851063)\n",
      "tensor(0.4917, device='cuda:0') tensor(0.5434, device='cuda:0')\n",
      "0.7676470588235295 0.772189349112426\n",
      "0.5529661016949152 0.9849056603773585\n",
      "0.6428571428571429 0.8656716417910447\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "972\n",
      "tensor(734)\n",
      "(tensor(0.4033), 0.5637860082304527, 0.7016460905349794)\n",
      "(tensor(0.4815), 0.8045267489711934, 0.7588555858310627)\n",
      "tensor(0.4917, device='cuda:0') tensor(0.4854, device='cuda:0')\n",
      "0.7676470588235295 0.7754491017964071\n",
      "0.5529661016949152 0.7174515235457064\n",
      "0.6428571428571429 0.7453237410071943\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "915\n",
      "tensor(733)\n",
      "(tensor(0.3792), 0.5492341356673961, 0.6896174863387978)\n",
      "(tensor(0.3233), 0.7221006564551422, 0.6971350613915416)\n",
      "0.7713414634146342 0.7909090909090909\n",
      "0.5476190476190477 0.49714285714285716\n",
      "0.6405063291139241 0.6105263157894737\n"
     ]
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "pos_indices = DVA.weak_set_weights.__gt__(0.0)\n",
    "labels, preds = torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1), torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1)\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(labels, preds, torch.ones([len(indices)])))\n",
    "print(WeightedAcc(labels, preds, DVA.weak_set_weights[indices]))\n",
    "# print(e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean())\n",
    "print(precision_score(labels, preds), precision_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(recall_score(labels, preds), recall_score(labels[pos_indices], preds[pos_indices]))\n",
    "print(f1_score(labels, preds), f1_score(labels[pos_indices], preds[pos_indices]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.5, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.\n",
      "  warnings.warn(warning.format(ret))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot   0 | 840 ####, loss/acc = 1.31827426/0.6600000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.20692754/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.12089229/0.7000000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.06153309/0.7200000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.02978802/0.6600000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.02279866/0.6200000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.02992809/0.6200000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.03769255/0.6400000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.04144049/0.6400000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.04066837/0.6400000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.03618884/0.6200000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.02942777/0.6000000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.02140248/0.6400000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.01358044/0.6200000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.00772548/0.6200000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.00577021/0.6600000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.00735319/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.00981665/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.01121640/0.7000000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.01071644/0.7000000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.00855350/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.00543261/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.00232422/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 1.00031483/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 0.99974978/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 0.99967951/0.6400000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 0.99925172/0.6400000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 0.99828720/0.6600000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 0.99716640/0.6800000\n",
      "####Few Shot   0 | 840 ####, loss/acc = 0.99649543/0.6800000\n",
      "=====> Optimized acc: (tensor(0.3862, device='cuda:1'), 0.8, 0.8)\n",
      "=====> Optimized weights: tensor([ 1.0203,  0.1793,  1.2399,  0.7171, -0.2350, -0.1850, -0.2038, -2.5273,\n",
      "         0.9597, -0.8931, -0.2247, -0.7230,  0.1184, -0.7251,  0.7877,  1.1190,\n",
      "        -0.2993,  0.5987, -0.9098,  0.3803], device='cuda:1')\n",
      "=====> init acc: (tensor(0.4000, device='cuda:1'), 0.8, 0.7)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.31827426/0.6600000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.20921445/0.6800000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.12905276/0.7000000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.07703698/0.7400000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.05378878/0.6600000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.05125892/0.6400000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.05630839/0.6000000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.05945873/0.6000000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.05780077/0.5800000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.05138731/0.5800000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.04168141/0.6000000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.03027070/0.6200000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.01896274/0.6400000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.00942147/0.6400000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.00363290/0.6400000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 1.00094378/0.6600000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.99876833/0.6800000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.99466836/0.7000000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.98840451/0.7000000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.98048407/0.7000000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.97217923/0.6800000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.96487290/0.6600000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.95888627/0.6200000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.95317239/0.6200000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.94688767/0.6200000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.94016993/0.6400000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.93382800/0.6600000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.92823440/0.6800000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.92338443/0.6800000\n",
      "####Few Shot  20 | 840 ####, loss/acc = 0.91911179/0.6800000\n",
      "=====> Optimized acc: (tensor(0.4071, device='cuda:1'), 0.9, 0.8181818181818182)\n",
      "=====> Optimized weights: tensor([-2.8225,  1.3999, -0.8849, -0.4469,  1.0113, -0.7855,  1.3430,  0.4634,\n",
      "         0.7924,  2.0711, -0.0903, -0.4491, -1.5394,  0.7117,  1.2216, -2.3651,\n",
      "         1.4043,  0.1818,  0.5891, -2.4301], device='cuda:1')\n",
      "=====> init acc: (tensor(0.1000, device='cuda:1'), 0.6, 0.55)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.31827426/0.6600000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.20244670/0.6800000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.11388731/0.7200000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.05366695/0.7200000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.01969099/0.6600000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.00710452/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.00759137/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.01263106/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.01837552/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.02223825/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.02368939/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.02264702/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.01926816/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.01398325/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 1.00719380/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.99923903/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.99047261/0.6800000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.98120230/0.6800000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.97233653/0.6800000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.96435463/0.6800000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.95812774/0.6600000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.95461136/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.95331049/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.95244813/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.95003718/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.94610232/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.94089627/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.93525159/0.6400000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.92994285/0.6600000\n",
      "####Few Shot  40 | 840 ####, loss/acc = 0.92541957/0.6800000\n",
      "=====> Optimized acc: (tensor(0.1594, device='cuda:1'), 0.6, 0.5625)\n",
      "=====> Optimized weights: tensor([ 1.4496,  0.7359,  1.2262,  0.0658,  0.6248,  0.7232,  0.5991,  1.7427,\n",
      "         0.6025,  1.1429,  1.1102, -0.2649,  0.8662,  1.2123, -0.5972,  1.5220,\n",
      "         1.2887,  0.7120, -1.2360, -0.5740], device='cuda:1')\n",
      "=====> init acc: (tensor(0.9000, device='cuda:1'), 0.9, 0.95)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.31827426/0.6600000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.25282550/0.7000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.19773448/0.6800000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.15233767/0.7000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.11700261/0.7200000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.09116507/0.7000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.07370710/0.7200000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.06286359/0.7000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.05835116/0.6400000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.05832136/0.6400000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.06075585/0.6200000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.06391728/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.06695735/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.06932712/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.07072496/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.07112515/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.07060003/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.06921434/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.06709278/0.6000000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot  60 | 840 ####, loss/acc = 1.06446278/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.06140256/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.05807650/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.05475926/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.05160260/0.6000000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.04867387/0.6200000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.04601490/0.6200000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.04373121/0.6400000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.04175770/0.6400000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.04035091/0.6600000\n",
      "####Few Shot  60 | 840 ####, loss/acc = 1.03937161/0.6600000\n",
      "=====> Optimized acc: (tensor(0.2114, device='cuda:1'), 1.0, 0.9285714285714286)\n",
      "=====> Optimized weights: tensor([ 1.0763,  1.0282, -0.3556,  0.2952, -1.2798, -0.0037,  0.8956, -1.4003,\n",
      "         0.4327, -1.8940,  0.8493,  1.1178, -2.4689,  0.9972,  1.0187,  0.4362,\n",
      "         1.0524,  1.1793,  1.0963,  1.0014], device='cuda:1')\n",
      "=====> init acc: (tensor(0.3000, device='cuda:1'), 0.7, 0.65)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.31827426/0.6600000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.22264743/0.6800000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.14569545/0.7200000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.08933842/0.7600000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.05583787/0.7000000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.04571080/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.05101728/0.6200000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.05709052/0.6200000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.05959547/0.6200000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.05821073/0.6200000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.05362940/0.6200000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.04713643/0.6200000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.04029071/0.6200000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.03455448/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.03212082/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.03246319/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.03367591/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.03434372/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.03364074/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.03105211/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.02750409/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.02370179/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.02033687/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.01818454/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.01706851/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.01618946/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.01483440/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.01289022/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.01065195/0.6400000\n",
      "####Few Shot  80 | 840 ####, loss/acc = 1.00892568/0.6400000\n",
      "=====> Optimized acc: (tensor(0.5551, device='cuda:1'), 0.8, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([ 0.9824,  0.0824, -1.9686,  1.9766, -0.8008, -2.1772,  1.0267,  0.1001,\n",
      "         0.2292,  0.1364,  0.9674,  1.1369,  0.0902, -2.0346,  0.1347,  0.1244,\n",
      "        -0.7271, -0.7261,  0.6809,  1.1297], device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.7, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.31827426/0.6600000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.24963880/0.6800000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.19318366/0.7000000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.14886355/0.7000000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.11628425/0.7200000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.09491670/0.7400000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.08253932/0.6800000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.07837236/0.6400000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.08033657/0.6400000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.08434665/0.6200000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.08754039/0.6200000\n",
      "####Few Shot 100 | 840 ####, loss/acc = 1.08877623/0.6200000\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-25-91717d09ca34>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mtmp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1e-1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2e-2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEvaluate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmax_epochs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_meta_steps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m30\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlr4weights\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.05\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# ferguson 上是0.1, sydney上是0.05\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      4\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDVA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscale_lr4model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtmp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m<ipython-input-12-fdcd8cddbbb9>\u001b[0m in \u001b[0;36mEvaluate\u001b[0;34m(self, max_epochs, max_meta_steps, lr4weights)\u001b[0m\n\u001b[1;32m     73\u001b[0m                 \u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindices\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSampleBatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindices\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     74\u001b[0m                 self.OptimizeWeights(step, batch, indices, lr4weights, few_shot_data,\n\u001b[0;32m---> 75\u001b[0;31m                                      tmp_model_device, max_meta_steps=max_meta_steps)\n\u001b[0m\u001b[1;32m     76\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweak_set_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweak_set_weights\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweak_set_weights\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     77\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m<ipython-input-12-fdcd8cddbbb9>\u001b[0m in \u001b[0;36mOptimizeWeights\u001b[0;34m(self, step, batch, indices, lr4weights, few_shot_data, device, tmp_model, max_meta_steps)\u001b[0m\n\u001b[1;32m     36\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mmeta_step\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmax_meta_steps\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     37\u001b[0m             \u001b[0mweights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mto_var\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzeros\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbatch_size\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtmp_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 38\u001b[0;31m             \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mComputeGrads4Weights\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mweights\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfew_shot_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     39\u001b[0m             \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgrad_weights\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mgrad_weights\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     40\u001b[0m             \u001b[0;31m# ==============Update process in Adam=======================\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/InstanceReweighting.py\u001b[0m in \u001b[0;36mComputeGrads4Weights\u001b[0;34m(self, step, batch, weights, tmp_model, few_shot_data)\u001b[0m\n\u001b[1;32m    251\u001b[0m         \u001b[0mmodel_grads\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mModelGrads\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mweights\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    252\u001b[0m         \u001b[0mupdate_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtmp_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlr4model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msource_params\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmodel_grads\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 253\u001b[0;31m         \u001b[0mloss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0macc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRDMLoss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfew_shot_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    254\u001b[0m         print('####Few Shot %3d | %3d ####, loss/acc = %6.8f/%6.7f' % (\n\u001b[1;32m    255\u001b[0m             \u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweak_set_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mloss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0macc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mRDMLoss\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    212\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    213\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mRDMLoss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 214\u001b[0;31m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    215\u001b[0m         \u001b[0mepsilon\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mones\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevice\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;36m1e-8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    216\u001b[0m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0mepsilon\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# to avoid the prediction [1.0, 0.0], which leads to the 'nan' value in log operation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    207\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    208\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 209\u001b[0;31m         \u001b[0mseq_outs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mBatch2Vecs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    210\u001b[0m         \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrdm_cls\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mseq_outs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msoftmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdim\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    211\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mpreds\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36mBatch2Vecs\u001b[0;34m(self, batch)\u001b[0m\n\u001b[1;32m    202\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mBatch2Vecs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    203\u001b[0m         \u001b[0mTD_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBU_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mseqs\u001b[0m \u001b[0;34m=\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 204\u001b[0;31m         \u001b[0minputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msent2vec\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msents\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0msents\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mseqs\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    205\u001b[0m         \u001b[0mseq_outs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprop_model\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mTD_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBU_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    206\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mseq_outs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/GraphRumorDect.py\u001b[0m in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m    202\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mBatch2Vecs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    203\u001b[0m         \u001b[0mTD_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBU_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mseqs\u001b[0m \u001b[0;34m=\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 204\u001b[0;31m         \u001b[0minputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msent2vec\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msents\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0msents\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mseqs\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    205\u001b[0m         \u001b[0mseq_outs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprop_model\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mTD_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBU_graphs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    206\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mseq_outs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, *input, **kwargs)\u001b[0m\n\u001b[1;32m    530\u001b[0m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_slow_forward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    531\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 532\u001b[0;31m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    533\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mhook\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_forward_hooks\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    534\u001b[0m             \u001b[0mhook_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhook\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/SentModel/Sent2Vec.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, sents)\u001b[0m\n\u001b[1;32m     78\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     79\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msents\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 80\u001b[0;31m         \u001b[0mtfidf_arr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvectorizer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtransform\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msents\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoarray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     81\u001b[0m         \u001b[0mtoken_ids\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtfidf_arr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margsort\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtop_K\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     82\u001b[0m         \u001b[0mweights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msort\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtfidf_arr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtop_K\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munsqueeze\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/sklearn/feature_extraction/text.py\u001b[0m in \u001b[0;36mtransform\u001b[0;34m(self, raw_documents, copy)\u001b[0m\n\u001b[1;32m   1678\u001b[0m         \u001b[0mcheck_is_fitted\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'_tfidf'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'The tfidf vector is not fitted'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1679\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1680\u001b[0;31m         \u001b[0mX\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtransform\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mraw_documents\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1681\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_tfidf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtransform\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1682\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/sklearn/feature_extraction/text.py\u001b[0m in \u001b[0;36mtransform\u001b[0;34m(self, raw_documents)\u001b[0m\n\u001b[1;32m   1110\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1111\u001b[0m         \u001b[0;31m# use the same matrix-building strategy as fit_transform\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1112\u001b[0;31m         \u001b[0m_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_count_vocab\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mraw_documents\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfixed_vocab\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1113\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1114\u001b[0m             \u001b[0mX\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfill\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/sklearn/feature_extraction/text.py\u001b[0m in \u001b[0;36m_count_vocab\u001b[0;34m(self, raw_documents, fixed_vocab)\u001b[0m\n\u001b[1;32m   1006\u001b[0m         X = sp.csr_matrix((values, j_indices, indptr),\n\u001b[1;32m   1007\u001b[0m                           \u001b[0mshape\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindptr\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvocabulary\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1008\u001b[0;31m                           dtype=self.dtype)\n\u001b[0m\u001b[1;32m   1009\u001b[0m         \u001b[0mX\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msort_indices\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1010\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mvocabulary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/scipy/sparse/compressed.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, arg1, shape, dtype, copy)\u001b[0m\n\u001b[1;32m    106\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0masarray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    107\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 108\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcheck_format\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfull_check\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    109\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    110\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mgetnnz\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/scipy/sparse/compressed.py\u001b[0m in \u001b[0;36mcheck_format\u001b[0;34m(self, full_check)\u001b[0m\n\u001b[1;32m    171\u001b[0m             raise ValueError(\"index pointer size ({}) should be ({})\"\n\u001b[1;32m    172\u001b[0m                              \"\".format(len(self.indptr), major_dim + 1))\n\u001b[0;32m--> 173\u001b[0;31m         \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindptr\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    174\u001b[0m             \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"index pointer should start with 0\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    175\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "tmp = (DVA.lr4model, DVA.scale_lr4model)\n",
    "DVA.lr4model, DVA.scale_lr4model = 1e-1, 2e-2\n",
    "DVA.Evaluate(max_epochs=2, max_meta_steps=30, lr4weights=0.05) # ferguson 上是0.1, sydney上是0.05\n",
    "DVA.lr4model, DVA.scale_lr4model = tmp[0], tmp[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "790\n",
      "tensor(290)\n",
      "(tensor(0.4354), 0.739240506329114, 0.7177215189873418)\n",
      "(tensor(0.0234), 0.7924050632911392, 0.8)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(tensor(0.4741, device='cuda:0'), tensor(0.5212, device='cuda:0'))"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1),\n",
    "            torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1),\n",
    "            torch.ones([len(indices)]))\n",
    "     )\n",
    "print(WeightedAcc(torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1),\n",
    "            torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1),\n",
    "            DVA.weak_set_weights[indices])\n",
    "     )\n",
    "e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.5833333333333334, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.\n",
      "  warnings.warn(warning.format(ret))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot   0 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.56722379/0.6351351\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.56170309/0.6351351\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.55642855/0.6351351\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.55082202/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.2469, device='cuda:1'), 0.75, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.4987, -0.2328, -0.2439, -0.4180, -0.4886,  0.4538,  0.4873, -0.4993,\n",
      "        -0.0736, -0.4599,  0.4704, -0.4844,  0.4939, -0.1954, -0.4658, -0.4917,\n",
      "        -0.4989, -0.4965, -0.4992,  0.3086, -0.5001, -0.4858, -0.4859,  0.2207],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1667, device='cuda:1'), 0.5, 0.5833333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.55775201/0.6351351\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.54377484/0.6486486\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.53042102/0.6621622\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.51554143/0.6621622\n",
      "=====> Optimized acc: (tensor(0.1112, device='cuda:1'), 0.5833333333333334, 0.75)\n",
      "=====> Optimized weights: tensor([-0.4938,  0.4475,  0.4541, -0.4922,  0.3820, -0.4915,  0.4321, -0.4989,\n",
      "        -0.4097,  0.4360, -0.1405, -0.4783, -0.4838, -0.4706, -0.2988, -0.4961,\n",
      "        -0.4808,  0.4217, -0.5010, -0.0852,  0.3954,  0.4645, -0.4351, -0.1806],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5833, device='cuda:1'), 0.8333333333333334, 0.7916666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.56496716/0.6216216\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.55637443/0.6216216\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.54820669/0.6216216\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.54053164/0.6351351\n",
      "=====> Optimized acc: (tensor(0.0082, device='cuda:1'), 0.75, 0.75)\n",
      "=====> Optimized weights: tensor([ 0.4959, -0.4967,  0.4956,  0.4589, -0.4995, -0.5012, -0.0248, -0.0840,\n",
      "         0.3981, -0.4839, -0.4971, -0.1700, -0.5010,  0.4263,  0.4933,  0.4732,\n",
      "         0.5011, -0.4915,  0.4920,  0.4970,  0.4853, -0.4921, -0.4639,  0.4410],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1667, device='cuda:1'), 0.6666666666666666, 0.5833333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.55798697/0.6216216\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.54248691/0.6216216\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.52769268/0.6351351\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.51366448/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.1413, device='cuda:1'), 0.5833333333333334, 0.5)\n",
      "=====> Optimized weights: tensor([ 0.4356, -0.5022, -0.4899,  0.4939, -0.4994, -0.2232,  0.5018, -0.3640,\n",
      "        -0.4861,  0.4257,  0.5003,  0.5018, -0.4835,  0.4917, -0.4387, -0.4658,\n",
      "        -0.4954, -0.5013, -0.4270,  0.4925, -0.4997, -0.4920, -0.5015, -0.3629],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.4167, device='cuda:1'), 0.8333333333333334, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.56089294/0.6216216\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.54804707/0.6216216\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.53605545/0.6351351\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.52409625/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.2087, device='cuda:1'), 0.75, 0.75)\n",
      "=====> Optimized weights: tensor([-0.5020,  0.5004, -0.3503, -0.2162,  0.5014, -0.4868, -0.4961, -0.5006,\n",
      "        -0.5017,  0.4639, -0.5006, -0.3159, -0.5005, -0.4503, -0.5014, -0.5013,\n",
      "        -0.4916,  0.4988, -0.5020, -0.4934, -0.4955, -0.4941, -0.5018, -0.5005],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.75, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.55443048/0.6216216\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.53660560/0.6216216\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.52058613/0.6351351\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.50546575/0.6351351\n",
      "=====> Optimized acc: (tensor(0.1713, device='cuda:1'), 0.8333333333333334, 0.8181818181818182)\n",
      "=====> Optimized weights: tensor([ 0.4983,  0.4864, -0.4985,  0.5006, -0.4928,  0.3607,  0.2377,  0.4925,\n",
      "         0.4833, -0.4958,  0.3379, -0.4995, -0.4438, -0.5005, -0.1840, -0.4962,\n",
      "         0.4926,  0.4797, -0.4910, -0.4071, -0.2495, -0.0523,  0.5016, -0.4159],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.6667, device='cuda:1'), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.55630207/0.6351351\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.54091990/0.6216216\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.52632987/0.6081081\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.51167059/0.6081081\n",
      "=====> Optimized acc: (tensor(-0.1051, device='cuda:1'), 0.8333333333333334, 0.8)\n",
      "=====> Optimized weights: tensor([-0.4991,  0.4847,  0.2054, -0.4819, -0.0418, -0.5008,  0.5007, -0.2653,\n",
      "         0.3427,  0.0525,  0.4572, -0.4972, -0.0726, -0.2466, -0.2019, -0.4942,\n",
      "         0.4990,  0.4713, -0.4980, -0.4909, -0.4954,  0.4101,  0.2599, -0.5005],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0833, device='cuda:1'), 0.5833333333333334, 0.4583333333333333)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.55713940/0.6486486\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.54251730/0.6621622\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.52865791/0.6756757\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.51523900/0.6756757\n",
      "=====> Optimized acc: (tensor(0.5838, device='cuda:1'), 0.6666666666666666, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([ 0.4961, -0.5012, -0.5010, -0.2903, -0.0850, -0.3286, -0.4934, -0.4869,\n",
      "        -0.4816, -0.0245, -0.4998, -0.5017,  0.4941, -0.4992,  0.4907,  0.4709,\n",
      "        -0.4968,  0.4929, -0.4024,  0.4402,  0.1925, -0.3925, -0.5020, -0.5013],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.6667, device='cuda:1'), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.56727195/0.6351351\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.56025052/0.6216216\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.55350149/0.6216216\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.54704642/0.6351351\n",
      "=====> Optimized acc: (tensor(0.1208, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3490,  0.4708, -0.1487,  0.0000, -0.4981,  0.4844,  0.4739, -0.4951,\n",
      "         0.4900, -0.4912,  0.4325, -0.4921, -0.4635, -0.3385, -0.4931, -0.4731,\n",
      "        -0.4809, -0.4850,  0.0072, -0.5015,  0.4600,  0.4804,  0.4992, -0.4973],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.6667, device='cuda:1'), 0.75, 0.8333333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 216 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.56119752/0.6351351\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.54860377/0.6351351\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.53611612/0.6621622\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.52382171/0.6621622\n",
      "=====> Optimized acc: (tensor(-0.2114, device='cuda:1'), 0.9166666666666666, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.4972,  0.4954,  0.4960, -0.4767, -0.4926, -0.5008, -0.4954, -0.4962,\n",
      "         0.4987, -0.4990,  0.4786, -0.5009,  0.4168, -0.0226,  0.4971, -0.4662,\n",
      "        -0.5015, -0.5021, -0.4790, -0.5014, -0.4999,  0.4980, -0.4998, -0.2980],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.6667, device='cuda:1'), 0.75, 0.8333333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.56253958/0.6216216\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.55254006/0.6216216\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.54295170/0.6351351\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.53287983/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.2756, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.4999,  0.0595, -0.4851, -0.3724, -0.4914, -0.4827, -0.2035, -0.4852,\n",
      "        -0.4980,  0.4976, -0.4930, -0.0714, -0.5016,  0.1265, -0.4606, -0.5003,\n",
      "         0.1730, -0.4846,  0.1203, -0.4945, -0.5015, -0.4976,  0.1475, -0.4974],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0833, device='cuda:1'), 0.6666666666666666, 0.5416666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.56476474/0.6216216\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.55602038/0.6081081\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.54824722/0.6216216\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.54128993/0.6216216\n",
      "=====> Optimized acc: (tensor(0.4743, device='cuda:1'), 0.8333333333333334, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.4308,  0.3943,  0.0094, -0.3748, -0.4627, -0.5013, -0.3475,  0.3677,\n",
      "         0.1173, -0.5002, -0.4986, -0.1279, -0.4604, -0.1117,  0.0000,  0.4470,\n",
      "        -0.5009, -0.4986, -0.2003, -0.4626,  0.0474,  0.0021, -0.1839, -0.4980],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.8333333333333334, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.57146347/0.6216216\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.56638587/0.6216216\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.56271565/0.6081081\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.55914652/0.6081081\n",
      "=====> Optimized acc: (tensor(0.1082, device='cuda:1'), 0.9166666666666666, 0.8888888888888888)\n",
      "=====> Optimized weights: tensor([ 0.4855, -0.4153, -0.4917, -0.3186, -0.4801, -0.4897,  0.4886,  0.4118,\n",
      "        -0.4934, -0.2855, -0.4929,  0.4051,  0.1361, -0.4768, -0.4277, -0.4904,\n",
      "         0.0304,  0.1039,  0.4569,  0.4498, -0.4806, -0.4884, -0.4908, -0.3130],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2500, device='cuda:1'), 0.5, 0.625)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.56887984/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.56404471/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.55875897/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.55306673/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.0441, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([ 0.2079, -0.4872, -0.4968, -0.2091, -0.4958, -0.4768,  0.2174, -0.4833,\n",
      "         0.3532,  0.4710, -0.4991, -0.4804,  0.2106, -0.4945,  0.3294, -0.4932,\n",
      "         0.3783,  0.1119, -0.4485, -0.4863, -0.4911,  0.2320, -0.4952, -0.1867],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.4167, device='cuda:1'), 0.8333333333333334, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.56321299/0.6351351\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.55207849/0.6351351\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.54151905/0.6216216\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.53153121/0.6351351\n",
      "=====> Optimized acc: (tensor(0.3308, device='cuda:1'), 0.8333333333333334, 1.0)\n",
      "=====> Optimized weights: tensor([-0.0279,  0.3554, -0.3103, -0.4930, -0.4848, -0.4995, -0.4043, -0.4898,\n",
      "         0.4531,  0.4948, -0.4982, -0.2083,  0.4904,  0.4808, -0.1463, -0.4889,\n",
      "         0.4845, -0.5008, -0.4994,  0.2065, -0.2577, -0.1287, -0.4623,  0.4750],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.7500, device='cuda:1'), 0.9166666666666666, 0.875)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.56894267/0.6216216\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.56391227/0.6216216\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.55918789/0.6216216\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.55467653/0.6216216\n",
      "=====> Optimized acc: (tensor(0.1389, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.3806,  0.3892, -0.4391,  0.4377, -0.4985,  0.4916,  0.4496,  0.4635,\n",
      "        -0.4948, -0.2052, -0.4532, -0.4870, -0.3639,  0.5022, -0.4518, -0.5020,\n",
      "        -0.4991, -0.4982, -0.5018, -0.5013,  0.4819,  0.0672,  0.5009,  0.4664],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.3333, device='cuda:1'), 0.5833333333333334, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.56564653/0.6351351\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.55783498/0.6486486\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.55058062/0.6621622\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.54347372/0.6621622\n",
      "=====> Optimized acc: (tensor(0.4399, device='cuda:1'), 0.8333333333333334, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.4954, -0.5011, -0.4933,  0.4787, -0.4856,  0.5019,  0.5015, -0.5019,\n",
      "         0.4387,  0.4904, -0.4812,  0.4857, -0.5007, -0.5015, -0.5002, -0.3548,\n",
      "        -0.5010, -0.4586, -0.4993,  0.0064, -0.4935, -0.5019,  0.4987,  0.0028],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.3333, device='cuda:1'), 0.5833333333333334, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.56229818/0.6351351\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.55232775/0.6216216\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.54220760/0.6216216\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.53262627/0.6351351\n",
      "=====> Optimized acc: (tensor(0.1559, device='cuda:1'), 0.75, 0.8181818181818182)\n",
      "=====> Optimized weights: tensor([ 0.1521, -0.3241, -0.4826, -0.4952, -0.3586, -0.4725,  0.3876,  0.4813,\n",
      "         0.0011, -0.4942, -0.4729, -0.4942,  0.4464,  0.4927, -0.1954,  0.3589,\n",
      "         0.3863, -0.4848, -0.3997, -0.4941, -0.4976,  0.2233,  0.2243,  0.4705],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.75, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 432 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.56981099/0.6351351\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.56592917/0.6351351\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.56280231/0.6216216\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.56021166/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.0686, device='cuda:1'), 0.8333333333333334, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.4947,  0.4247, -0.4935, -0.4388,  0.4836, -0.0096, -0.4895, -0.4973,\n",
      "        -0.4710, -0.4887,  0.0066, -0.0578, -0.4917, -0.1006,  0.4750,  0.4743,\n",
      "        -0.4972,  0.4611, -0.4827, -0.4723, -0.4975, -0.4958,  0.4572, -0.1783],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2500, device='cuda:1'), 0.6666666666666666, 0.625)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.55631793/0.6216216\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.53891659/0.6216216\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.52143931/0.6351351\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.50428271/0.6351351\n",
      "=====> Optimized acc: (tensor(0.1822, device='cuda:1'), 0.8333333333333334, 0.7777777777777778)\n",
      "=====> Optimized weights: tensor([ 0.4497, -0.4997, -0.2564,  0.4992,  0.5012,  0.4819,  0.1331, -0.5020,\n",
      "        -0.4725,  0.3831, -0.4440, -0.4947,  0.4968, -0.4977,  0.4434,  0.4727,\n",
      "        -0.4983, -0.4997, -0.4777, -0.4590, -0.2912, -0.5019, -0.4991, -0.4998],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.75, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.55874467/0.6216216\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.54407811/0.6216216\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.53000283/0.6351351\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.51556718/0.6351351\n",
      "=====> Optimized acc: (tensor(0.1178, device='cuda:1'), 0.8333333333333334, 0.8888888888888888)\n",
      "=====> Optimized weights: tensor([-0.4863, -0.5007, -0.0391, -0.4974,  0.4910, -0.4981, -0.2882, -0.5003,\n",
      "         0.4924,  0.4990,  0.4880,  0.0949, -0.5004,  0.4968,  0.4843, -0.0156,\n",
      "        -0.4989, -0.4786, -0.4979, -0.5006, -0.5004,  0.1369, -0.4979,  0.4947],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1667, device='cuda:1'), 0.5, 0.5833333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.55300939/0.6351351\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.53171849/0.6621622\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.51113176/0.6756757\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.49305546/0.6756757\n",
      "=====> Optimized acc: (tensor(0.0404, device='cuda:1'), 0.5833333333333334, 0.5384615384615384)\n",
      "=====> Optimized weights: tensor([ 0.4793,  0.4873,  0.4779, -0.4969,  0.5003, -0.4783, -0.4865, -0.4967,\n",
      "         0.4429,  0.3819,  0.4734, -0.4995, -0.4888,  0.5011,  0.4966,  0.1226,\n",
      "         0.4450, -0.4932,  0.0000,  0.0000, -0.2118,  0.2838, -0.4901,  0.3975],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.6666666666666666, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.56041431/0.6216216\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.54702902/0.6216216\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.53382254/0.6081081\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.52066958/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.2530, device='cuda:1'), 0.8333333333333334, 0.8)\n",
      "=====> Optimized weights: tensor([ 0.4982, -0.4816, -0.4969, -0.5000,  0.4925, -0.5011, -0.5016, -0.5018,\n",
      "        -0.4164, -0.4964, -0.5017, -0.5007, -0.5002, -0.4959, -0.1355,  0.4624,\n",
      "        -0.4616, -0.4990, -0.4989, -0.4941, -0.0580,  0.4548, -0.4128,  0.4459],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.3333, device='cuda:1'), 0.75, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.56937408/0.6351351\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.56199765/0.6216216\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.55715728/0.6081081\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.55166054/0.6081081\n",
      "=====> Optimized acc: (tensor(0.0786, device='cuda:1'), 0.75, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.4907, -0.4723, -0.4836, -0.4833,  0.0611,  0.4702, -0.0334,  0.4759,\n",
      "        -0.4919, -0.3091,  0.3684,  0.3435, -0.4801, -0.4188, -0.4929, -0.4401,\n",
      "        -0.4810, -0.4868,  0.4481, -0.4300, -0.1109, -0.3982, -0.4565, -0.4211],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5833, device='cuda:1'), 0.6666666666666666, 0.7916666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.56489563/0.6351351\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.55700028/0.6351351\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.54924083/0.6081081\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.54259300/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.0598, device='cuda:1'), 0.9166666666666666, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.2362,  0.4982, -0.4993,  0.4974, -0.1205, -0.4995, -0.2356,  0.4223,\n",
      "        -0.4992, -0.4914, -0.3131, -0.4943, -0.3824, -0.4938,  0.4789, -0.4985,\n",
      "        -0.4938, -0.4886,  0.4337, -0.2260, -0.4818, -0.3878,  0.4929,  0.4943],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1667, device='cuda:1'), 0.6666666666666666, 0.5833333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.55561376/0.6351351\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.54015362/0.6351351\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.52688146/0.6486486\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.51360893/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.0753, device='cuda:1'), 0.5833333333333334, 0.625)\n",
      "=====> Optimized weights: tensor([-0.2879, -0.4934, -0.4914,  0.4604,  0.4743, -0.4687, -0.4853, -0.4040,\n",
      "         0.4989, -0.4957,  0.2539, -0.4934, -0.4937, -0.4994, -0.3166, -0.4742,\n",
      "        -0.4145, -0.4988, -0.5007,  0.4601, -0.3298,  0.0194,  0.4462,  0.4700],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0833, device='cuda:1'), 0.5833333333333334, 0.5416666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.54843783/0.6216216\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.52443302/0.6216216\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.50128126/0.6216216\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.47940290/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.0815, device='cuda:1'), 0.5, 0.5454545454545454)\n",
      "=====> Optimized weights: tensor([ 0.4963,  0.5016,  0.3830, -0.4950,  0.5001, -0.4998, -0.4964,  0.4915,\n",
      "        -0.0018, -0.4904,  0.4861, -0.4653, -0.4561, -0.1149, -0.4997,  0.4702,\n",
      "        -0.4752, -0.4658,  0.4959,  0.4768,  0.4878, -0.4895, -0.4845,  0.4784],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.6667, device='cuda:1'), 1.0, 0.8333333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 648 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.56469333/0.6351351\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.55647469/0.6486486\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.54949403/0.6621622\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.54285967/0.6621622\n",
      "=====> Optimized acc: (tensor(0.3653, device='cuda:1'), 0.9166666666666666, 0.9230769230769231)\n",
      "=====> Optimized weights: tensor([-0.0524,  0.4417,  0.4783,  0.4784,  0.1977,  0.1164,  0.4844, -0.2133,\n",
      "        -0.0448, -0.4956,  0.4847, -0.4990, -0.4985,  0.4787,  0.3264,  0.4697,\n",
      "        -0.3872,  0.2066, -0.5010, -0.1942,  0.4802,  0.4694, -0.4974, -0.4988],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.7500, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.56421447/0.6351351\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.55464506/0.6486486\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.54525995/0.6486486\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.53626978/0.6486486\n",
      "=====> Optimized acc: (tensor(0.2498, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-0.5003, -0.4723, -0.3098, -0.5003,  0.4471,  0.4913,  0.4847, -0.4883,\n",
      "         0.4928, -0.4389, -0.4813, -0.5020,  0.4537,  0.4688,  0.4981, -0.4994,\n",
      "        -0.4288,  0.4990, -0.1651,  0.4924,  0.4856,  0.0973, -0.0636, -0.5019],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5000, device='cuda:1'), 0.6666666666666666, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.56414056/0.6351351\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.54927814/0.6351351\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.53678906/0.6351351\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.52596545/0.6486486\n",
      "=====> Optimized acc: (tensor(0.0562, device='cuda:1'), 0.8333333333333334, 0.8)\n",
      "=====> Optimized weights: tensor([-0.0918,  0.4275, -0.4605, -0.4542,  0.0141, -0.4344, -0.3125,  0.0780,\n",
      "        -0.4992,  0.2566,  0.4888, -0.1273, -0.1448,  0.3865,  0.0216, -0.3870,\n",
      "        -0.4297,  0.3593, -0.4950, -0.0173, -0.2503,  0.1656, -0.5000,  0.0838],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.7500, device='cuda:1'), 0.9166666666666666, 0.875)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.56651270/0.6216216\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.55940700/0.6216216\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.55272257/0.6216216\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.54650533/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.6047, device='cuda:1'), 0.75, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.0028, -0.5014,  0.3625, -0.4964,  0.4071, -0.4805, -0.3602, -0.1262,\n",
      "        -0.4815, -0.0585, -0.5012,  0.1276, -0.2728, -0.4950,  0.1438,  0.4939,\n",
      "         0.4793, -0.0325, -0.4857, -0.4975, -0.4964, -0.4278, -0.4994, -0.4686],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.4167, device='cuda:1'), 0.6666666666666666, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.57435298/0.6081081\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.56914485/0.6351351\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.56443739/0.6351351\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.55922091/0.6486486\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.55502355/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.2426, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.3533, -0.4274, -0.4836, -0.4199,  0.3683,  0.1479,  0.0743,  0.4734,\n",
      "         0.0621, -0.0572, -0.4938, -0.2533, -0.3170,  0.4770, -0.4970,  0.2603,\n",
      "         0.2646, -0.1963, -0.1259,  0.2451, -0.4967, -0.4654, -0.4933, -0.4556],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.3634, device='cuda:1'), 0.8333333333333334, 0.7916666666666666)\n",
      "=====> init weights: tensor([ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,\n",
      "         0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,\n",
      "         0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000, -0.4987, -0.2328],\n",
      "       device='cuda:1')\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.56740487/0.6216216\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.55992520/0.6351351\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.55422902/0.6486486\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.54843295/0.6756757\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.54236865/0.6756757\n",
      "=====> Optimized acc: (tensor(-0.0141, device='cuda:1'), 0.8333333333333334, 0.8888888888888888)\n",
      "=====> Optimized weights: tensor([ 0.1420, -0.4847, -0.4160, -0.4961, -0.4825,  0.4339,  0.1590, -0.4657,\n",
      "        -0.2143, -0.4962, -0.4349, -0.3232,  0.4751, -0.0766,  0.1509, -0.4585,\n",
      "         0.4780,  0.1700,  0.4519, -0.2439,  0.0443, -0.4970, -0.9977, -0.7164],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0847, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> init weights: tensor([ 0.0015, -0.0015,  0.0013,  0.0004,  0.0015, -0.0016, -0.0006,  0.0016,\n",
      "        -0.0016, -0.0015, -0.0006, -0.0016, -0.0015, -0.0015, -0.0007, -0.0002,\n",
      "         0.0014, -0.0010, -0.0010,  0.0002, -0.0012, -0.0006,  0.0016, -0.0016],\n",
      "       device='cuda:1')\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.57398224/0.6081081\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.54760242/0.6081081\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.52262866/0.6216216\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.49816251/0.6351351\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.47442055/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.0613, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> Optimized weights: tensor([ 0.4611, -0.4865,  0.4976, -0.0080,  0.5033, -0.4986,  0.4505,  0.5029,\n",
      "        -0.4978, -0.5004, -0.2916, -0.5002, -0.5026, -0.4491, -0.5014, -0.4762,\n",
      "         0.4986, -0.4941, -0.4780,  0.4984, -0.4816, -0.0348,  0.4989, -0.5023],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1333, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> init weights: tensor([-0.0015,  0.0015, -0.0016, -0.0015, -0.0004, -0.0015,  0.0015, -0.0015,\n",
      "         0.0015,  0.0015, -0.0015, -0.0015, -0.0016, -0.0006, -0.0015,  0.0011,\n",
      "        -0.0016, -0.0015, -0.0015, -0.0015,  0.0008,  0.0014, -0.0015,  0.0016],\n",
      "       device='cuda:1')\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.57428002/0.6081081\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.56976628/0.6216216\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.56552911/0.6216216\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.56129622/0.6216216\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.55708265/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.1465, device='cuda:1'), 0.8333333333333334, 0.7777777777777778)\n",
      "=====> Optimized weights: tensor([-0.4954,  0.4981, -0.5034, -0.4992,  0.0425, -0.4908,  0.4924, -0.4930,\n",
      "         0.2125,  0.4802, -0.5034, -0.5027, -0.5032,  0.4840, -0.4943,  0.4205,\n",
      "        -0.5030, -0.4664, -0.4858, -0.3404,  0.3618, -0.1805, -0.5011,  0.5006],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0543, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> init weights: tensor([-1.5629e-03,  1.5291e-03, -2.9995e-05, -1.5182e-03,  1.2136e-03,\n",
      "        -1.5477e-03, -1.5566e-03,  1.4873e-03, -1.5629e-03, -1.5630e-03,\n",
      "        -1.4865e-03, -1.5234e-03,  1.5474e-03, -1.4751e-03, -1.5015e-03,\n",
      "        -1.4726e-03, -1.5544e-03, -1.4785e-03, -1.5647e-03, -8.2735e-04,\n",
      "        -1.5442e-03,  1.4912e-03, -1.5453e-03,  1.5612e-03], device='cuda:1')\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.57424617/0.6081081\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.56759739/0.6216216\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.56168664/0.6351351\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.55609703/0.6486486\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot  48 | 790 ####, loss/acc = 1.55067539/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.0100, device='cuda:1'), 0.75, 1.0)\n",
      "=====> Optimized weights: tensor([-0.5026,  0.4418, -0.0072, -0.4523,  0.4883, -0.4994, -0.5034,  0.4979,\n",
      "        -0.4908, -0.5030, -0.4937, -0.5033,  0.4586, -0.4485, -0.0012, -0.5033,\n",
      "        -0.5002, -0.4840, -0.5006, -0.3796, -0.5037,  0.4903, -0.5009,  0.4065],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.2875, device='cuda:1'), 0.75, 0.6666666666666666)\n",
      "=====> init weights: tensor([-1.5470e-03, -1.5515e-03, -1.5368e-03, -1.5559e-03, -1.5418e-03,\n",
      "        -1.2950e-03,  1.4809e-03, -1.5618e-03,  1.5132e-03,  1.5608e-03,\n",
      "        -1.2872e-03, -1.5281e-03, -1.5333e-03, -1.5635e-03, -1.5633e-03,\n",
      "         1.3809e-03, -5.1473e-04, -1.5622e-03,  1.5532e-03, -7.7284e-05,\n",
      "         1.4839e-03, -1.5380e-03, -1.3325e-03, -1.0554e-03], device='cuda:1')\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.57413828/0.6081081\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.56206822/0.6351351\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.55356836/0.6216216\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.54655743/0.6351351\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.53863478/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.1351, device='cuda:1'), 0.75, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.1933, -0.4514, -0.4972, -0.4974, -0.4987, -0.0160,  0.3596, -0.5008,\n",
      "         0.4901,  0.4430, -0.4324, -0.4809, -0.4826, -0.4749, -0.1929,  0.2643,\n",
      "         0.4394, -0.1546,  0.1910, -0.0236,  0.4588,  0.0840, -0.4930,  0.1743],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0675, device='cuda:1'), 0.8333333333333334, 0.8888888888888888)\n",
      "=====> init weights: tensor([-0.0015, -0.0013,  0.0015,  0.0015,  0.0011,  0.0016, -0.0016,  0.0016,\n",
      "         0.0014,  0.0015, -0.0016, -0.0016, -0.0015, -0.0016, -0.0001, -0.0002,\n",
      "        -0.0015, -0.0009, -0.0016,  0.0011, -0.0015,  0.0016, -0.0002, -0.0015],\n",
      "       device='cuda:1')\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.57414627/0.6081081\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.56033993/0.6351351\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.55065322/0.6486486\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.54137444/0.6621622\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.53121138/0.6621622\n",
      "=====> Optimized acc: (tensor(-0.0427, device='cuda:1'), 0.8333333333333334, 0.9)\n",
      "=====> Optimized weights: tensor([-0.4473, -0.4232,  0.4365,  0.4693,  0.3697,  0.4691, -0.5016,  0.1653,\n",
      "         0.2528,  0.3226, -0.4915, -0.4697, -0.4827, -0.3370, -0.0390,  0.2425,\n",
      "        -0.4990, -0.4591, -0.4882,  0.4995, -0.4999,  0.4874, -0.1971, -0.4823],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0598, device='cuda:1'), 1.0, 1.0)\n",
      "=====> init weights: tensor([-0.0015, -0.0013, -0.0016, -0.0015, -0.0016,  0.0000, -0.0007, -0.0016,\n",
      "        -0.0015, -0.0016, -0.0015,  0.0015, -0.0015, -0.0015, -0.0016, -0.0016,\n",
      "        -0.0015, -0.0015,  0.0016, -0.0015,  0.0014,  0.0008,  0.0015,  0.0015],\n",
      "       device='cuda:1')\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.57416272/0.6081081\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.56365335/0.6351351\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.55707133/0.6351351\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.54906046/0.6621622\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.54061329/0.6486486\n",
      "=====> Optimized acc: (tensor(0.2102, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-0.3349,  0.0058, -0.3941, -0.1805, -0.4095,  0.0000, -0.2192, -0.4227,\n",
      "        -0.4855, -0.2401, -0.4997,  0.2752,  0.1871, -0.4946, -0.4989, -0.4969,\n",
      "         0.1872, -0.4893,  0.4805, -0.4729, -0.0719,  0.2943,  0.4362, -0.0055],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0246, device='cuda:1'), 0.75, 0.7272727272727273)\n",
      "=====> init weights: tensor([-0.0015,  0.0015, -0.0015,  0.0014,  0.0011, -0.0016, -0.0013,  0.0008,\n",
      "         0.0016, -0.0016, -0.0014, -0.0015, -0.0011,  0.0015, -0.0013, -0.0001,\n",
      "         0.0015,  0.0015, -0.0015, -0.0015,  0.0015, -0.0016,  0.0013,  0.0014],\n",
      "       device='cuda:1')\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.57407844/0.6081081\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.55425227/0.6216216\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.53485036/0.6351351\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.51576626/0.6486486\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.49773860/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.1170, device='cuda:1'), 0.75, 0.7)\n",
      "=====> Optimized weights: tensor([-0.5004,  0.4937, -0.4951, -0.1742,  0.4629, -0.5007, -0.3707,  0.5023,\n",
      "         0.5009, -0.4903, -0.4751, -0.4502, -0.4846,  0.4925, -0.3476, -0.0185,\n",
      "         0.4985,  0.4187, -0.4945, -0.4981,  0.0693, -0.5025,  0.4859,  0.5032],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2005, device='cuda:1'), 1.0, 1.0)\n",
      "=====> init weights: tensor([-0.0016, -0.0015, -0.0015,  0.0015,  0.0006,  0.0015,  0.0015, -0.0016,\n",
      "        -0.0004, -0.0011, -0.0005,  0.0003, -0.0010,  0.0016,  0.0016, -0.0016,\n",
      "        -0.0015,  0.0005, -0.0016, -0.0015, -0.0016, -0.0015, -0.0015,  0.0014],\n",
      "       device='cuda:1')\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.57410097/0.6081081\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.55759513/0.6351351\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.54204905/0.6216216\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.52704394/0.6351351\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.51229572/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.0097, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> Optimized weights: tensor([-0.5026, -0.4892, -0.5016,  0.4272,  0.1082,  0.3707,  0.4607, -0.5021,\n",
      "        -0.3306, -0.4231,  0.3856, -0.4116, -0.4731,  0.4685,  0.1854, -0.5015,\n",
      "        -0.0801, -0.4759, -0.4855, -0.5003, -0.4895, -0.4691, -0.5004,  0.4850],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.4385, device='cuda:1'), 0.9166666666666666, 0.9090909090909091)\n",
      "=====> init weights: tensor([-0.0016,  0.0014,  0.0004, -0.0013, -0.0015, -0.0015, -0.0015,  0.0015,\n",
      "        -0.0015, -0.0012,  0.0015,  0.0014,  0.0013,  0.0015, -0.0006,  0.0007,\n",
      "        -0.0016,  0.0006, -0.0015, -0.0006, -0.0015,  0.0013,  0.0014, -0.0015],\n",
      "       device='cuda:1')\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.57415307/0.6081081\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.56642568/0.6486486\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.56136501/0.6486486\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.55523145/0.6351351\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.54949605/0.6486486\n",
      "=====> Optimized acc: (tensor(0.2566, device='cuda:1'), 0.75, 0.7777777777777778)\n",
      "=====> Optimized weights: tensor([-0.4999,  0.4299, -0.1163,  0.1986, -0.4950, -0.4982, -0.4974, -0.0756,\n",
      "        -0.4816,  0.2213, -0.1569, -0.2438,  0.2883,  0.4084,  0.4430, -0.1284,\n",
      "        -0.4873, -0.0169, -0.4645, -0.4785, -0.3071,  0.3717,  0.4735,  0.1547],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.2388, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> init weights: tensor([ 1.5355e-03, -1.5650e-03,  0.0000e+00, -1.5555e-03, -1.5653e-03,\n",
      "         1.3971e-03, -1.5235e-03, -1.5561e-03,  1.1466e-03,  1.5550e-03,\n",
      "        -1.4132e-03, -9.6741e-04, -1.4393e-03,  1.6362e-04, -1.5632e-03,\n",
      "        -1.5543e-03, -1.4300e-03,  1.1204e-03, -1.5607e-03, -1.5271e-03,\n",
      "        -1.1686e-03,  6.7785e-04,  2.2512e-05,  1.2085e-03], device='cuda:1')\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.57419074/0.6081081\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.56227958/0.6351351\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.55079460/0.6216216\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.53985989/0.6216216\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.52911639/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.3104, device='cuda:1'), 0.6666666666666666, 0.625)\n",
      "=====> Optimized weights: tensor([ 0.3161, -0.4933,  0.0000, -0.4993, -0.5036,  0.4723, -0.4997, -0.5001,\n",
      "         0.2085,  0.4897, -0.4803, -0.4592, -0.4026, -0.4727, -0.5004, -0.4980,\n",
      "        -0.4906,  0.0681, -0.4980, -0.4933, -0.3837,  0.4612,  0.3380,  0.4720],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0528, device='cuda:1'), 0.75, 0.7)\n",
      "=====> init weights: tensor([-1.5523e-03,  1.5370e-03, -1.3683e-03,  1.5600e-03, -3.9684e-04,\n",
      "        -6.0555e-04, -7.6324e-05, -1.4612e-03, -3.9257e-04,  6.0596e-05,\n",
      "        -1.5644e-03,  1.1246e-03, -1.5609e-03, -1.3964e-04,  1.4811e-03,\n",
      "        -1.5005e-03, -1.0921e-03,  1.5534e-03,  1.5490e-03,  1.5515e-03,\n",
      "         6.8823e-04, -1.5384e-03, -1.5085e-03,  1.5113e-03], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 240 | 790 ####, loss/acc = 1.57425261/0.6081081\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.56796658/0.6216216\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.56233227/0.6216216\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.55669022/0.6216216\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.55113530/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.2089, device='cuda:1'), 0.6666666666666666, 0.6)\n",
      "=====> Optimized weights: tensor([-0.5008,  0.5011, -0.0432,  0.5031, -0.1277,  0.3860, -0.0619, -0.4926,\n",
      "        -0.4337, -0.3706, -0.5038,  0.4779, -0.5010, -0.4809,  0.4933,  0.0084,\n",
      "        -0.4166,  0.4999,  0.5021,  0.4963, -0.4716, -0.5007, -0.5014,  0.4770],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2504, device='cuda:1'), 0.8333333333333334, 0.8888888888888888)\n",
      "=====> init weights: tensor([ 0.0014, -0.0015,  0.0014, -0.0015,  0.0014,  0.0015, -0.0009, -0.0016,\n",
      "        -0.0015, -0.0015,  0.0004, -0.0014, -0.0016,  0.0004,  0.0016, -0.0016,\n",
      "         0.0015, -0.0009, -0.0016, -0.0016,  0.0010, -0.0015, -0.0010, -0.0005],\n",
      "       device='cuda:1')\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.57412684/0.6081081\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.55868959/0.6216216\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.54387438/0.6216216\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.52984130/0.6216216\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.51592731/0.6216216\n",
      "=====> Optimized acc: (tensor(0.0557, device='cuda:1'), 0.9166666666666666, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([ 0.0512, -0.4830, -0.3189, -0.5003,  0.4960,  0.4981, -0.5023, -0.5033,\n",
      "        -0.4611, -0.5002, -0.4857, -0.4976, -0.5002, -0.4995,  0.4963, -0.5020,\n",
      "         0.4836, -0.2413, -0.5037, -0.4992,  0.4177, -0.5029, -0.2001, -0.1969],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0708, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> init weights: tensor([-1.2969e-03, -1.5628e-03, -1.5567e-03,  1.5193e-03, -1.5559e-03,\n",
      "        -1.3680e-03, -9.7583e-04, -1.5461e-03,  1.3825e-04, -1.4995e-03,\n",
      "         3.5006e-06, -1.5574e-03, -6.1205e-04, -1.4452e-03, -1.5307e-03,\n",
      "        -1.5529e-03, -1.3844e-03, -1.5651e-03, -1.5609e-03,  1.5112e-03,\n",
      "        -1.7825e-04,  1.5491e-03, -1.5275e-03, -1.5640e-03], device='cuda:1')\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.57423127/0.6081081\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.56704009/0.6351351\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.56120861/0.6351351\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.55491948/0.6486486\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.54829836/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.0460, device='cuda:1'), 0.75, 0.7142857142857143)\n",
      "=====> Optimized weights: tensor([-0.4395, -0.4969, -0.4957,  0.2588, -0.4984,  0.1899, -0.4828, -0.4966,\n",
      "        -0.1633,  0.1985, -0.2486, -0.2365, -0.1181,  0.2268, -0.0445, -0.5016,\n",
      "        -0.0203, -0.5017, -0.4829,  0.4764,  0.0356,  0.4807, -0.4896, -0.5008],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2457, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> init weights: tensor([-1.5240e-03, -1.5646e-03, -1.4354e-03, -9.6380e-04, -1.5386e-03,\n",
      "        -3.1108e-03, -1.5162e-03, -1.5190e-03, -1.5600e-03,  1.3680e-03,\n",
      "         9.4684e-05,  1.2329e-03, -1.5659e-03, -7.3460e-04, -1.5598e-03,\n",
      "        -1.5385e-03,  1.5634e-03,  6.9609e-04, -1.5546e-03,  1.1083e-03,\n",
      "        -1.5445e-03, -1.5582e-03,  1.4927e-03,  1.3291e-03], device='cuda:1')\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.57419252/0.6081081\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.57328570/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.56339538/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.55541742/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.55031419/0.6216216\n",
      "=====> Optimized acc: (tensor(0.0966, device='cuda:1'), 0.75, 0.7777777777777778)\n",
      "=====> Optimized weights: tensor([-0.4821, -0.4943, -0.4557,  0.0099, -0.1007, -0.4986, -0.4907, -0.4981,\n",
      "        -0.1265, -0.1116,  0.1788,  0.4794, -0.1562, -0.0298, -0.4964, -0.3652,\n",
      "         0.4395,  0.1700, -0.4901,  0.3168, -0.4969,  0.0235,  0.1733,  0.4739],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2819, device='cuda:1'), 0.75, 0.8571428571428571)\n",
      "=====> init weights: tensor([-1.2417e-03, -1.5394e-03, -2.8621e-04, -1.4422e-03,  4.7039e-04,\n",
      "         1.5640e-03,  1.5566e-03, -1.2547e-03, -7.9939e-04, -1.4522e-03,\n",
      "        -8.9859e-04, -1.4968e-03,  1.1942e-03,  1.1946e-03, -5.7079e-06,\n",
      "        -1.0105e-03, -1.5542e-03, -1.5595e-03, -1.5329e-03,  5.3933e-04,\n",
      "         6.4823e-04, -1.5652e-03, -1.5478e-03, -1.5631e-03], device='cuda:1')\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.57405031/0.6081081\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.55469179/0.6351351\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.53690231/0.6216216\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.51952505/0.6216216\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.50307429/0.6216216\n",
      "=====> Optimized acc: (tensor(0.0714, device='cuda:1'), 0.6666666666666666, 0.7142857142857143)\n",
      "=====> Optimized weights: tensor([-0.4744, -0.4956,  0.1293, -0.4789,  0.4973,  0.4899,  0.5010, -0.0949,\n",
      "        -0.3347, -0.4585, -0.4181, -0.4643, -0.0269,  0.2979,  0.0774, -0.2699,\n",
      "        -0.5033, -0.4980, -0.4311, -0.4818,  0.0930, -0.4978, -0.4994, -0.5004],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0089, device='cuda:1'), 0.6666666666666666, 0.7272727272727273)\n",
      "=====> init weights: tensor([ 0.0015,  0.0015,  0.0014, -0.0015,  0.0007, -0.0016,  0.0014,  0.0013,\n",
      "        -0.0015, -0.0015,  0.0004, -0.0015,  0.0016, -0.0015,  0.0015,  0.0004,\n",
      "        -0.0016, -0.0014, -0.0013,  0.0011, -0.0016, -0.0015, -0.0004, -0.0004],\n",
      "       device='cuda:1')\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.57424915/0.6081081\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.56657982/0.6081081\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.56031239/0.6216216\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.55440617/0.6081081\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.54875314/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.0226, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([ 0.4830,  0.4894,  0.1614, -0.4343, -0.4800, -0.5028,  0.3647,  0.4607,\n",
      "        -0.4984, -0.4925, -0.0427, -0.4993,  0.4407, -0.4975,  0.4942, -0.1556,\n",
      "        -0.4580,  0.0514, -0.5026,  0.5020, -0.4993, -0.4994, -0.4618, -0.1937],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1647, device='cuda:1'), 0.75, 0.8333333333333334)\n",
      "=====> init weights: tensor([-0.0015, -0.0010,  0.0015, -0.0016, -0.0010, -0.0012,  0.0012, -0.0015,\n",
      "         0.0015,  0.0015, -0.0015, -0.0003,  0.0015, -0.0016, -0.0014, -0.0015,\n",
      "        -0.0015,  0.0000, -0.0007, -0.0015, -0.0008, -0.0016, -0.0015,  0.0015],\n",
      "       device='cuda:1')\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.57413828/0.6081081\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.55982566/0.6216216\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.54613686/0.6216216\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.53318214/0.6216216\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.52065372/0.6216216\n",
      "=====> Optimized acc: (tensor(0.1783, device='cuda:1'), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.5033, -0.2696,  0.4846, -0.5012, -0.4999, -0.3719,  0.2690, -0.2492,\n",
      "         0.4937,  0.4922, -0.5036, -0.4949,  0.4942, -0.5033, -0.4328, -0.5004,\n",
      "        -0.4905,  0.0000, -0.1670, -0.5012, -0.4982, -0.5028, -0.4790,  0.5003],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0468, device='cuda:1'), 0.5833333333333334, 0.6666666666666666)\n",
      "=====> init weights: tensor([ 1.4760e-03, -4.8587e-05,  4.2687e-04, -1.5024e-03,  1.4918e-03,\n",
      "         1.4617e-03, -1.4358e-03, -7.6056e-04, -1.5419e-03, -1.5527e-03,\n",
      "        -1.4232e-03, -1.5653e-03, -1.5387e-03, -1.5111e-03,  1.4922e-03,\n",
      "         1.3877e-03, -2.2963e-04,  6.7294e-05,  1.3649e-03, -1.4912e-03,\n",
      "        -1.5652e-03, -1.5572e-03, -1.5623e-03,  1.2045e-03], device='cuda:1')\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.57420623/0.6081081\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.56740499/0.6351351\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.55947888/0.6351351\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.55112445/0.6351351\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.54376876/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.0629, device='cuda:1'), 0.5833333333333334, 0.7142857142857143)\n",
      "=====> Optimized weights: tensor([ 0.4750, -0.0261, -0.2111,  0.0908, -0.0459,  0.3005, -0.4838, -0.4614,\n",
      "        -0.4971, -0.4887, -0.4993, -0.5019, -0.4871, -0.4763,  0.4057,  0.4831,\n",
      "         0.4612, -0.0917, -0.4522, -0.3862, -0.4995, -0.4980, -0.4933,  0.4886],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(-0.1168, device='cuda:1'), 0.5833333333333334, 0.75)\n",
      "=====> init weights: tensor([-0.0006, -0.0013, -0.0013, -0.0002,  0.0015,  0.0015,  0.0015, -0.0014,\n",
      "         0.0014, -0.0015, -0.0015,  0.0015, -0.0009,  0.0005, -0.0014, -0.0016,\n",
      "        -0.0022, -0.0008, -0.0015, -0.0015,  0.0015,  0.0012, -0.0015, -0.0015],\n",
      "       device='cuda:1')\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.57408822/0.6081081\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.55825388/0.6486486\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.54078770/0.6216216\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.52600324/0.6486486\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.51072240/0.6486486\n",
      "=====> Optimized acc: (tensor(0.0467, device='cuda:1'), 0.8333333333333334, 0.75)\n",
      "=====> Optimized weights: tensor([-0.3911, -0.3250, -0.4289, -0.0585,  0.4711,  0.4930,  0.4892, -0.2344,\n",
      "        -0.0854, -0.4530, -0.4732,  0.4484,  0.0247, -0.4067, -0.4265, -0.4923,\n",
      "        -0.2952, -0.4933, -0.3728, -0.4961,  0.4199,  0.3580, -0.4968,  0.0872],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1605, device='cuda:1'), 0.75, 0.875)\n",
      "=====> init weights: tensor([ 1.2630e-03, -1.3092e-03,  1.3726e-03, -6.2943e-04, -6.5211e-04,\n",
      "        -1.5547e-03, -1.2923e-03, -1.5439e-03,  3.8232e-04, -1.5304e-03,\n",
      "        -1.5589e-03,  1.5137e-03, -1.4726e-03, -1.5069e-03,  1.8538e-04,\n",
      "        -1.4895e-03, -5.3988e-05,  6.4091e-06, -1.2072e-03,  1.5469e-03,\n",
      "        -6.4960e-04,  2.9596e-04, -1.5313e-03, -1.5553e-03], device='cuda:1')\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.57420158/0.6081081\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.56313121/0.6351351\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.55241144/0.6486486\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.54243731/0.6486486\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.53234553/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.0527, device='cuda:1'), 0.75, 0.75)\n",
      "=====> Optimized weights: tensor([ 0.4348, -0.4405,  0.4240, -0.4920,  0.2741, -0.5035, -0.4946, -0.4913,\n",
      "         0.4190, -0.5030, -0.5017,  0.4940, -0.4793, -0.4982,  0.4537, -0.5015,\n",
      "        -0.4926,  0.0202, -0.5014,  0.4999, -0.1035, -0.4087, -0.5019, -0.5036],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.3166, device='cuda:1'), 0.75, 0.75)\n",
      "=====> init weights: tensor([-1.6302e-04, -1.5378e-03,  1.5446e-03,  1.5533e-03, -1.5552e-03,\n",
      "        -1.5414e-03, -1.5621e-03,  1.3274e-03, -1.5332e-03, -9.0525e-04,\n",
      "         1.2693e-03, -1.5565e-03, -1.1061e-03,  1.4740e-03,  1.2393e-03,\n",
      "         1.5308e-03,  8.1147e-04, -1.5555e-03,  1.5428e-03, -7.0477e-05,\n",
      "         1.1867e-03, -2.6509e-04,  1.5548e-03,  1.4636e-03], device='cuda:1')\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.57423115/0.6081081\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.56533337/0.6351351\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.55813897/0.6351351\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.55118597/0.6621622\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.54425156/0.6621622\n",
      "=====> Optimized acc: (tensor(0.2130, device='cuda:1'), 0.75, 0.7272727272727273)\n",
      "=====> Optimized weights: tensor([-0.0813, -0.4996, -0.0078,  0.3618, -0.5035, -0.4444, -0.5030,  0.3417,\n",
      "        -0.4309, -0.0936,  0.4497, -0.5017, -0.3219,  0.4657,  0.5013,  0.5024,\n",
      "         0.4124, -0.5020,  0.4434, -0.0244,  0.4963, -0.1458,  0.4743,  0.4885],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.2058, device='cuda:1'), 0.8333333333333334, 0.8888888888888888)\n",
      "=====> init weights: tensor([ 1.5359e-03, -1.0077e-03,  1.5369e-03, -1.5496e-03, -1.1924e-03,\n",
      "         1.5106e-03,  1.5217e-03, -1.5013e-03, -1.5388e-03, -1.5110e-03,\n",
      "         2.0484e-05,  1.5380e-03, -1.5606e-03,  1.4655e-03, -1.4866e-03,\n",
      "         1.5623e-03, -1.5426e-03, -1.5572e-03, -1.5637e-03, -1.5610e-03,\n",
      "        -1.5343e-03, -1.5511e-03, -1.4524e-03,  1.0272e-03], device='cuda:1')\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.57411540/0.6081081\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.56232810/0.6351351\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.55620384/0.6216216\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.55140972/0.6216216\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.54598379/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.3313, device='cuda:1'), 0.8333333333333334, 0.7777777777777778)\n",
      "=====> Optimized weights: tensor([ 0.4517,  0.2526,  0.4739, -0.4873,  0.0524,  0.4110,  0.4716, -0.4675,\n",
      "        -0.4539, -0.4822, -0.2046,  0.1553, -0.4882, -0.2152, -0.4670, -0.1036,\n",
      "        -0.4604, -0.3873, -0.4852, -0.4871,  0.0434, -0.0555, -0.4642,  0.1940],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1757, device='cuda:1'), 0.5, 0.5714285714285714)\n",
      "=====> init weights: tensor([ 0.0015, -0.0015, -0.0016, -0.0016, -0.0011, -0.0010,  0.0003, -0.0007,\n",
      "         0.0006, -0.0011, -0.0016, -0.0015,  0.0015, -0.0016,  0.0015,  0.0015,\n",
      "        -0.0015,  0.0014, -0.0016, -0.0013, -0.0014, -0.0015, -0.0004, -0.0015],\n",
      "       device='cuda:1')\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.57413447/0.6081081\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.55963612/0.6216216\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.54609740/0.6351351\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.53189576/0.6351351\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.51752055/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.1912, device='cuda:1'), 0.5833333333333334, 0.5)\n",
      "=====> Optimized weights: tensor([ 0.4783, -0.4985, -0.4996, -0.4974, -0.2560, -0.4878,  0.5002, -0.2561,\n",
      "        -0.4780, -0.5030, -0.4993, -0.5010,  0.5003, -0.4990,  0.4817,  0.5011,\n",
      "        -0.5030,  0.5023, -0.5026, -0.3345, -0.5031, -0.4739, -0.1715, -0.4943],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1760, device='cuda:1'), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> init weights: tensor([-1.5378e-03,  1.4017e-03, -1.5509e-03,  4.4065e-05, -1.4220e-03,\n",
      "        -7.6051e-04, -1.5569e-03, -1.5642e-03,  1.5278e-03,  3.9437e-04,\n",
      "        -1.5374e-03, -1.4983e-03, -5.7368e-04, -1.5068e-03, -9.0792e-04,\n",
      "        -1.4686e-03, -3.4579e-04,  2.9381e-05, -1.5649e-03, -1.4522e-03,\n",
      "        -1.5373e-03, -1.5074e-03,  1.0710e-03, -9.2903e-04], device='cuda:1')\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.57416093/0.6081081\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.55938804/0.6216216\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.54511368/0.6216216\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.53134811/0.6216216\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.51759934/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.0815, device='cuda:1'), 0.9166666666666666, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-0.5025,  0.4814, -0.4992,  0.4971, -0.4984, -0.4848, -0.5038, -0.5022,\n",
      "         0.4906,  0.0294, -0.4979, -0.4888,  0.3907, -0.5023, -0.3367, -0.4376,\n",
      "        -0.4559,  0.4852, -0.5033, -0.1614, -0.4998, -0.5022,  0.4457, -0.2972],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2465, device='cuda:1'), 1.0, 1.0)\n",
      "=====> init weights: tensor([-1.5534e-03,  1.5355e-03,  1.4482e-03, -1.5264e-03, -1.1181e-03,\n",
      "        -1.5607e-03, -1.5051e-03, -1.5289e-03, -1.5498e-03,  1.5638e-03,\n",
      "         1.4376e-03,  1.4991e-03, -1.5530e-03, -1.4744e-03, -1.5558e-03,\n",
      "        -1.5445e-03, -1.5561e-03,  1.4147e-03,  1.1797e-03, -1.5611e-03,\n",
      "        -1.5507e-03,  8.7572e-06, -1.5606e-03, -8.0361e-04], device='cuda:1')\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.57414675/0.6081081\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.56419778/0.6351351\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.55749226/0.6216216\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.55016637/0.6216216\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.54268944/0.6081081\n",
      "=====> Optimized acc: (tensor(0.5429, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-0.4553,  0.4709,  0.4945, -0.4659, -0.1587, -0.4975,  0.1850, -0.4989,\n",
      "        -0.4995, -0.1161,  0.4631,  0.4703, -0.4955, -0.3920, -0.2078,  0.1321,\n",
      "        -0.4989,  0.4795,  0.3921, -0.1485, -0.4998,  0.4525, -0.2332,  0.0958],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0900, device='cuda:1'), 0.9166666666666666, 0.9)\n",
      "=====> init weights: tensor([ 0.0004, -0.0016, -0.0015,  0.0015, -0.0002, -0.0016, -0.0015,  0.0002,\n",
      "        -0.0013, -0.0008, -0.0015,  0.0015, -0.0006,  0.0005, -0.0015,  0.0016,\n",
      "         0.0014, -0.0013, -0.0016, -0.0015, -0.0016,  0.0015,  0.0015,  0.0016],\n",
      "       device='cuda:1')\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.57418656/0.6081081\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 600 | 790 ####, loss/acc = 1.56458473/0.6351351\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.55763364/0.6486486\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.55044532/0.6486486\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.54301560/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.0421, device='cuda:1'), 0.9166666666666666, 0.875)\n",
      "=====> Optimized weights: tensor([ 0.2566, -0.4961, -0.4914,  0.4952, -0.1042, -0.4985, -0.4966, -0.1532,\n",
      "        -0.4231, -0.1610, -0.4898,  0.2908, -0.2546, -0.4537, -0.4992,  0.4977,\n",
      "         0.4926, -0.4405, -0.4995, -0.4957, -0.5015,  0.4969,  0.4965,  0.1478],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0865, device='cuda:1'), 0.6666666666666666, 0.6875)\n",
      "=====> init weights: tensor([-0.0002, -0.0015,  0.0013, -0.0015,  0.0004, -0.0003,  0.0014, -0.0015,\n",
      "        -0.0016, -0.0016,  0.0014,  0.0015, -0.0016,  0.0016,  0.0013,  0.0015,\n",
      "         0.0012,  0.0016,  0.0012,  0.0012,  0.0011,  0.0015,  0.0015,  0.0014],\n",
      "       device='cuda:1')\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.57415712/0.6081081\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.56635237/0.6081081\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.55644941/0.6216216\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.54580569/0.6216216\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.53559256/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.0250, device='cuda:1'), 0.6666666666666666, 0.6923076923076923)\n",
      "=====> Optimized weights: tensor([-0.0220,  0.0101,  0.3169, -0.4911,  0.2077, -0.1214,  0.4689, -0.4941,\n",
      "        -0.5004, -0.4890,  0.1294,  0.4955, -0.1633,  0.2802,  0.2626,  0.2608,\n",
      "        -0.1758,  0.4162, -0.4157,  0.4842, -0.2254,  0.3198, -0.1056,  0.2271],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2245, device='cuda:1'), 0.9166666666666666, 0.9090909090909091)\n",
      "=====> init weights: tensor([-6.6518e-04, -6.6813e-04, -1.5656e-03,  1.3772e-03,  1.4787e-03,\n",
      "         1.5328e-03,  0.0000e+00, -1.3335e-03, -1.5565e-03, -1.5144e-03,\n",
      "        -1.5395e-03,  1.0177e-03, -1.5107e-03, -1.5489e-03,  1.5626e-03,\n",
      "         1.4666e-03,  1.5560e-03, -8.6904e-06, -3.9891e-04,  1.4158e-03,\n",
      "         1.5104e-03,  6.0022e-04,  1.4794e-04, -1.5571e-03], device='cuda:1')\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.57422745/0.6081081\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.56518555/0.6486486\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.55761218/0.6621622\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.55123246/0.6621622\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.54543114/0.6756757\n",
      "=====> Optimized acc: (tensor(0.2698, device='cuda:1'), 0.9166666666666666, 0.9)\n",
      "=====> Optimized weights: tensor([-0.1624,  0.4652, -0.4983,  0.4552,  0.1528, -0.0269,  0.0000, -0.1031,\n",
      "        -0.2341, -0.4900, -0.5019,  0.4175, -0.4994, -0.4994,  0.4657, -0.1125,\n",
      "         0.5028, -0.0013,  0.4792,  0.5023,  0.4855,  0.4817, -0.4794, -0.5012],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1549, device='cuda:1'), 0.75, 0.7142857142857143)\n",
      "=====> init weights: tensor([-1.2093e-03,  1.5157e-03,  4.7420e-04, -1.5638e-03,  1.5355e-03,\n",
      "        -1.5425e-03, -1.4160e-03, -1.5130e-03, -9.8834e-04,  1.4150e-03,\n",
      "        -1.5557e-03, -8.6851e-05, -1.3432e-03, -1.5163e-03, -1.5573e-03,\n",
      "        -1.5490e-03, -1.5460e-03, -1.5469e-03, -1.5124e-03,  1.3826e-03,\n",
      "        -1.4464e-03, -1.5508e-03,  7.9173e-04,  7.2328e-04], device='cuda:1')\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.57419753/0.6081081\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.56410205/0.6351351\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.55441606/0.6216216\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.54492533/0.6216216\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.53539586/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.0782, device='cuda:1'), 0.75, 0.75)\n",
      "=====> Optimized weights: tensor([-0.3868,  0.4571,  0.2812, -0.4992,  0.0145, -0.5016, -0.5012, -0.1536,\n",
      "        -0.4971,  0.4750, -0.5002, -0.0293, -0.4812, -0.4937, -0.5027, -0.5031,\n",
      "        -0.5028, -0.5021, -0.4985,  0.4834,  0.2328, -0.4590,  0.4895,  0.1988],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.3180, device='cuda:1'), 0.9166666666666666, 0.9)\n",
      "=====> init weights: tensor([ 0.0007, -0.0015, -0.0016,  0.0016, -0.0015, -0.0015, -0.0014,  0.0011,\n",
      "         0.0006,  0.0015,  0.0002, -0.0011, -0.0016, -0.0001, -0.0015,  0.0014,\n",
      "        -0.0015, -0.0014,  0.0015, -0.0016,  0.0015, -0.0016, -0.0015,  0.0014],\n",
      "       device='cuda:1')\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.57409441/0.6081081\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.55681062/0.6216216\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.54054558/0.6216216\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.52569509/0.6351351\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.51170099/0.6351351\n",
      "=====> Optimized acc: (tensor(0.3563, device='cuda:1'), 0.8333333333333334, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.4852, -0.4954, -0.5009,  0.4810, -0.4997, -0.5022, -0.3518,  0.4905,\n",
      "         0.1667,  0.4991, -0.1708, -0.2628, -0.5026, -0.5019, -0.0361,  0.4953,\n",
      "        -0.5021, -0.0021,  0.3677, -0.5024,  0.4983, -0.5019, -0.4998,  0.4979],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1156, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> init weights: tensor([ 1.4679e-03,  1.4685e-03,  1.5070e-03,  1.5400e-03, -2.6185e-04,\n",
      "         1.5412e-03, -1.5616e-03,  5.2993e-04,  1.2997e-03,  2.0061e-05,\n",
      "        -1.5570e-03, -1.5046e-03, -1.4361e-03, -1.3985e-03, -1.4428e-03,\n",
      "        -1.4310e-03, -1.2605e-03,  1.5445e-03, -1.4816e-03, -1.0425e-04,\n",
      "        -1.2774e-03, -1.5597e-03, -1.5554e-03, -4.2257e-04], device='cuda:1')\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.57430720/0.6081081\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.57107353/0.6216216\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.56817484/0.6216216\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.56539881/0.6216216\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.56266665/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.2679, device='cuda:1'), 0.9166666666666666, 0.8888888888888888)\n",
      "=====> Optimized weights: tensor([ 0.5034,  0.4824,  0.5006,  0.4927, -0.1877,  0.4910, -0.5008, -0.4874,\n",
      "         0.4889, -0.4679, -0.4958, -0.4997, -0.5020, -0.5036, -0.4616, -0.4836,\n",
      "        -0.5023,  0.1357, -0.5027,  0.4763, -0.4823, -0.5015, -0.5035,  0.4727],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.2731, device='cuda:1'), 0.8333333333333334, 0.6666666666666666)\n",
      "=====> init weights: tensor([-0.0014,  0.0015, -0.0008, -0.0007,  0.0005, -0.0010, -0.0014, -0.0015,\n",
      "        -0.0013, -0.0006,  0.0015, -0.0002, -0.0015, -0.0015, -0.0011,  0.0008,\n",
      "        -0.0016,  0.0016, -0.0015, -0.0016, -0.0005, -0.0012, -0.0002,  0.0014],\n",
      "       device='cuda:1')\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.57431817/0.6081081\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.57213926/0.6216216\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.56935692/0.6216216\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.56695449/0.6351351\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.56469357/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.1695, device='cuda:1'), 0.75, 0.7777777777777778)\n",
      "=====> Optimized weights: tensor([-0.4653,  0.4606, -0.3332, -0.1703,  0.1859, -0.4765, -0.2150, -0.4901,\n",
      "        -0.4976,  0.0269,  0.4070,  0.4772, -0.3877, -0.4966, -0.4827,  0.4481,\n",
      "        -0.4985,  0.5002, -0.4890, -0.4965,  0.3484, -0.4791, -0.3974,  0.4850],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.9717, device='cuda:1'), 0.5833333333333334, 0.5384615384615384)\n",
      "=====> init weights: tensor([ 1.4974e-03, -1.0880e-03,  1.5645e-03, -1.5089e-03,  1.2786e-03,\n",
      "         2.6142e-04,  2.3160e-04,  1.4452e-03,  1.5333e-03,  1.5105e-03,\n",
      "        -4.5612e-04, -1.3560e-03,  1.4181e-03,  8.8486e-04, -1.5368e-03,\n",
      "        -1.5341e-03, -2.6566e-04,  1.9037e-04, -1.5157e-03,  3.2396e-04,\n",
      "        -1.3839e-03, -1.5582e-03,  4.6112e-01, -4.8648e-01], device='cuda:1')\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.57661235/0.6216216\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.56869364/0.6216216\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.55417991/0.6216216\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.54026651/0.6081081\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.52875459/0.6081081\n",
      "=====> Optimized acc: (tensor(-0.0143, device='cuda:1'), 0.5833333333333334, 0.5454545454545454)\n",
      "=====> Optimized weights: tensor([ 0.4404,  0.0566,  0.2217, -0.4532,  0.4485, -0.2455, -0.1771,  0.1860,\n",
      "         0.4596,  0.4634, -0.0923, -0.4586,  0.1349,  0.0659, -0.4332, -0.3891,\n",
      "        -0.2659,  0.2291, -0.4705, -0.1399, -0.3922, -0.4904,  0.3285, -0.9214],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(-0.2741, device='cuda:1'), 0.6666666666666666, 0.7142857142857143)\n",
      "=====> init weights: tensor([-1.5056e-03,  8.1936e-04, -1.6032e-03, -1.6302e-03, -1.5758e-03,\n",
      "         1.6237e-03, -1.6181e-03, -1.5958e-03, -1.4050e-03, -1.4873e-04,\n",
      "        -7.9122e-05, -2.3321e-04, -3.0791e-04, -1.5147e-03,  1.6319e-03,\n",
      "         1.5705e-03,  1.5409e-03, -1.6327e-03, -1.3975e-03,  9.7471e-04,\n",
      "         6.0121e-04, -1.5598e-03, -1.5450e-03, -1.3725e-03], device='cuda:1')\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.57431912/0.6081081\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.56927216/0.6216216\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.56417799/0.6216216\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.55938518/0.6351351\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.55463338/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.1903, device='cuda:1'), 0.75, 0.625)\n",
      "=====> Optimized weights: tensor([-0.4715, -0.2198, -0.4977, -0.5031, -0.5003,  0.5013, -0.4999, -0.4983,\n",
      "        -0.4965,  0.4603, -0.0465,  0.4641, -0.5008, -0.4862,  0.5036,  0.4927,\n",
      "         0.5035, -0.5022, -0.4916,  0.4575,  0.5020, -0.4994, -0.4964, -0.3152],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0859, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> init weights: tensor([-7.1488e-05, -1.6203e-03, -4.7285e-04, -1.5977e-03, -1.3514e-03,\n",
      "         1.6098e-03, -1.6159e-03, -1.5717e-03, -1.5938e-03,  1.4330e-03,\n",
      "         1.5215e-03,  1.6216e-03, -1.3983e-03, -1.6153e-03, -1.5879e-03,\n",
      "         9.1226e-04, -7.5634e-04, -1.5990e-03,  1.6123e-03, -1.6279e-03,\n",
      "         1.6285e-03, -1.5412e-03,  1.5450e-03, -1.1847e-03], device='cuda:1')\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.57424188/0.6081081\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.56619680/0.6216216\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.55838525/0.6216216\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.55083632/0.6216216\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.54309809/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.1036, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> Optimized weights: tensor([-0.0682, -0.5024, -0.1639, -0.4938, -0.4061,  0.4905, -0.5010, -0.4992,\n",
      "        -0.4934,  0.4655,  0.5009,  0.4998, -0.4915, -0.5014, -0.5024,  0.4950,\n",
      "        -0.5021, -0.4998,  0.4750, -0.5033,  0.4950, -0.4890,  0.3735, -0.5023],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0149, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> init weights: tensor([-1.5699e-03,  1.5885e-03,  8.8910e-04, -9.9610e-04, -1.6232e-03,\n",
      "         2.8300e-04,  8.5163e-04, -1.6212e-03, -1.6336e-03,  1.6292e-03,\n",
      "         1.3544e-03,  1.2025e-03, -7.9634e-04,  8.7288e-05, -1.6210e-03,\n",
      "        -1.4024e-03, -4.9820e-04,  1.6089e-03, -1.2547e-03, -1.5129e-03,\n",
      "        -1.6226e-03, -1.6205e-03, -1.3190e-03, -1.6105e-03], device='cuda:1')\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.57421184/0.6081081\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.56475568/0.6351351\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.55687952/0.6486486\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.54866922/0.6486486\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.54130185/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.1457, device='cuda:1'), 0.6666666666666666, 0.5714285714285714)\n",
      "=====> Optimized weights: tensor([-0.4752,  0.4983,  0.4773, -0.4965, -0.4984, -0.4497,  0.4938, -0.4969,\n",
      "        -0.5024,  0.4893,  0.4601,  0.4866, -0.1305, -0.0056, -0.4992, -0.4306,\n",
      "        -0.4930,  0.4182, -0.3784, -0.4980, -0.4731, -0.5020, -0.0539, -0.5017],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2041, device='cuda:1'), 0.8333333333333334, 0.8181818181818182)\n",
      "=====> init weights: tensor([-1.4967e-03,  1.4284e-03,  1.0465e-03,  1.5274e-03,  1.2522e-03,\n",
      "         1.5698e-03, -1.3726e-03, -1.4643e-03, -1.6243e-03,  1.5552e-03,\n",
      "         1.5333e-03,  2.9468e-04, -1.2722e-03, -1.6231e-03, -1.6316e-03,\n",
      "        -1.6156e-03, -1.2563e-03, -1.4980e-03,  6.0000e-04,  1.5210e-03,\n",
      "        -1.5340e-03, -1.5598e-03, -8.7352e-05,  6.4380e-04], device='cuda:1')\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.57426560/0.6081081\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.56986618/0.6351351\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.56452060/0.6351351\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.56025779/0.6351351\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.55602956/0.6351351\n",
      "=====> Optimized acc: (tensor(0.2001, device='cuda:1'), 0.8333333333333334, 0.8)\n",
      "=====> Optimized weights: tensor([-0.4998,  0.4987,  0.4849,  0.4602,  0.4067,  0.2806, -0.4701, -0.4952,\n",
      "        -0.5011,  0.4811,  0.0810, -0.4337, -0.4975, -0.5004, -0.4625, -0.5006,\n",
      "        -0.4982,  0.0623, -0.3383,  0.4837, -0.0727, -0.4908,  0.4121, -0.4404],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.2524, device='cuda:1'), 0.75, 0.7142857142857143)\n",
      "=====> init weights: tensor([ 1.4764e-03, -1.4767e-03,  1.5626e-03, -1.5657e-03, -4.5381e-04,\n",
      "        -1.3257e-03, -1.6340e-03, -1.4896e-03, -1.6052e-03, -1.5805e-03,\n",
      "        -9.4595e-04, -8.7252e-05, -1.6305e-03,  1.5501e-03, -5.2216e-04,\n",
      "         1.6116e-03, -1.6214e-03,  1.6151e-03, -1.6223e-03,  1.5089e-03,\n",
      "         6.8931e-04, -2.9888e-03, -1.5521e-03, -1.4423e-04], device='cuda:1')\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.57417178/0.6081081\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.56284034/0.6081081\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.55176449/0.6081081\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.54037297/0.6216216\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.52908945/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.2173, device='cuda:1'), 0.75, 0.75)\n",
      "=====> Optimized weights: tensor([-0.1408, -0.5018,  0.4975, -0.4929, -0.1060,  0.0898, -0.5025, -0.3355,\n",
      "        -0.4346, -0.4653, -0.2675,  0.1837, -0.4396,  0.4536, -0.4730,  0.4950,\n",
      "        -0.4937,  0.4886, -0.4885,  0.4916,  0.4632, -0.4931, -0.2916, -0.4879],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0294, device='cuda:1'), 0.9166666666666666, 0.8333333333333334)\n",
      "=====> init weights: tensor([-1.4891e-03, -1.6187e-03, -1.1276e-03,  6.1956e-04,  7.8667e-04,\n",
      "        -1.6172e-03, -1.5913e-03, -1.6171e-03, -1.6279e-03, -1.6200e-03,\n",
      "        -7.6033e-04, -1.6126e-03, -4.1771e-06,  1.6097e-03, -1.6001e-03,\n",
      "        -1.1043e-03,  1.5551e-03,  6.2936e-04,  1.4651e-03, -1.6207e-03,\n",
      "        -1.5941e-03, -1.2091e-03, -4.1429e-04, -1.6341e-03], device='cuda:1')\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.57408965/0.6081081\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.55488694/0.6216216\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.53676975/0.6351351\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.51977515/0.6351351\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.50547051/0.6351351\n",
      "=====> Optimized acc: (tensor(0.0015, device='cuda:1'), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.4569, -0.4987, -0.3358,  0.4916,  0.4452, -0.4734, -0.4035, -0.5024,\n",
      "        -0.5035, -0.5037, -0.4924, -0.5035, -0.0006,  0.5025, -0.5017, -0.4884,\n",
      "         0.4769,  0.4997,  0.4827, -0.4918, -0.5034, -0.4967, -0.0615, -0.5022],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1067, device='cuda:1'), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> init weights: tensor([ 0.0012, -0.0016,  0.0016, -0.0016, -0.0003,  0.0016, -0.0016,  0.0015,\n",
      "         0.0014, -0.0016, -0.0015,  0.0007,  0.0013,  0.0012, -0.0015, -0.0016,\n",
      "        -0.0016,  0.0016,  0.0015,  0.0003, -0.0003,  0.0010, -0.0016, -0.0007],\n",
      "       device='cuda:1')\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.57420921/0.6081081\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.56444132/0.6351351\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.55614591/0.6486486\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.54843569/0.6486486\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.54059470/0.6621622\n",
      "=====> Optimized acc: (tensor(0.1352, device='cuda:1'), 0.8333333333333334, 0.8461538461538461)\n",
      "=====> Optimized weights: tensor([ 0.2234, -0.4829,  0.4794, -0.5014,  0.1940,  0.4796, -0.4988,  0.5000,\n",
      "         0.4861, -0.4906, -0.4815,  0.2284,  0.3959,  0.2891, -0.4836, -0.5034,\n",
      "        -0.4315,  0.3126,  0.4076, -0.4868,  0.4933,  0.4925, -0.0610, -0.2709],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2359, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> init weights: tensor([-1.5809e-03,  4.3755e-04,  1.5480e-03, -1.5920e-03, -1.6316e-03,\n",
      "        -1.6082e-03, -4.8157e-04, -1.6335e-03, -1.4040e-03,  3.1078e-04,\n",
      "        -1.6257e-03,  3.2677e-05, -6.0871e-04, -1.6333e-03,  1.5030e-03,\n",
      "        -2.6006e-05, -1.6287e-03,  1.5195e-03,  1.5912e-03, -1.2666e-04,\n",
      "        -1.6325e-03,  1.4368e-03, -1.5656e-03, -1.6326e-03], device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 168 | 790 ####, loss/acc = 1.57409704/0.6081081\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.55828595/0.6351351\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.54781079/0.6216216\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.53609216/0.6486486\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.52484703/0.6486486\n",
      "=====> Optimized acc: (tensor(0.1922, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> Optimized weights: tensor([-0.4767,  0.0419, -0.1930, -0.3619, -0.4952, -0.4824, -0.1259, -0.4903,\n",
      "         0.0324,  0.1168, -0.4894,  0.1076, -0.0565, -0.4972,  0.2799, -0.4366,\n",
      "        -0.4942,  0.2797,  0.4247, -0.0428, -0.4846,  0.4290, -0.4777, -0.4920],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0171, device='cuda:1'), 0.75, 0.8571428571428571)\n",
      "=====> init weights: tensor([-0.0016,  0.0014, -0.0016, -0.0008, -0.0006, -0.0016,  0.0010, -0.0016,\n",
      "        -0.0016, -0.0007, -0.0016,  0.0014,  0.0002, -0.0011,  0.0015, -0.0016,\n",
      "        -0.0016, -0.0016, -0.0016,  0.0016, -0.0016,  0.0016, -0.0016, -0.0016],\n",
      "       device='cuda:1')\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.57411718/0.6081081\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.56029439/0.6351351\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.54817426/0.6216216\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.53563607/0.6081081\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.52341354/0.6216216\n",
      "=====> Optimized acc: (tensor(0.1333, device='cuda:1'), 0.75, 0.75)\n",
      "=====> Optimized weights: tensor([-0.5010,  0.4896, -0.3075, -0.2563, -0.1133, -0.5013,  0.3756, -0.5018,\n",
      "        -0.4998,  0.4575, -0.4969,  0.3830, -0.0044, -0.0025,  0.4801, -0.2999,\n",
      "        -0.4928, -0.4996, -0.0545,  0.4699,  0.0036,  0.4987, -0.5025, -0.5020],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0308, device='cuda:1'), 0.8333333333333334, 0.8)\n",
      "=====> init weights: tensor([ 0.0016,  0.0016, -0.0016, -0.0016, -0.0005,  0.0011,  0.0012,  0.0002,\n",
      "        -0.0016, -0.0016, -0.0012, -0.0016,  0.0016,  0.0015, -0.0016,  0.0007,\n",
      "        -0.0016,  0.0006, -0.0016, -0.0016, -0.0016, -0.0013,  0.0000,  0.0014],\n",
      "       device='cuda:1')\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.57423294/0.6081081\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.57302761/0.6351351\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.56699288/0.6351351\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.56085193/0.6351351\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.55565679/0.6351351\n",
      "=====> Optimized acc: (tensor(0.0631, device='cuda:1'), 0.8333333333333334, 0.9)\n",
      "=====> Optimized weights: tensor([ 0.4736,  0.4031, -0.4095, -0.4958,  0.2355, -0.2086, -0.2434,  0.4683,\n",
      "         0.2288, -0.0505, -0.4123, -0.4993,  0.3414,  0.4399, -0.4951,  0.2185,\n",
      "        -0.4980, -0.4808,  0.0545, -0.5020, -0.5020, -0.4955,  0.0000,  0.1550],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1446, device='cuda:1'), 0.9166666666666666, 0.875)\n",
      "=====> init weights: tensor([ 1.4103e-03,  1.5849e-03, -2.5227e-05,  9.3526e-04, -1.4548e-03,\n",
      "         1.3857e-03, -1.6134e-03,  1.3200e-03, -1.6194e-03, -1.5403e-03,\n",
      "        -1.5897e-03, -1.5216e-03, -1.6166e-03, -1.6136e-03, -6.4918e-04,\n",
      "        -1.4873e-03,  1.1536e-04,  1.4158e-03, -1.5976e-03, -1.6324e-03,\n",
      "        -9.4938e-05, -1.5350e-03,  1.6215e-03, -1.6207e-03], device='cuda:1')\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.57419145/0.6081081\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.56797791/0.6351351\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.56056082/0.6351351\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.55164444/0.6486486\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.54357123/0.6486486\n",
      "=====> Optimized acc: (tensor(0.3230, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.4748,  0.4768, -0.1668,  0.3675, -0.1959,  0.4706, -0.4976, -0.1432,\n",
      "        -0.2042, -0.5032, -0.5036,  0.2103, -0.4901, -0.5017, -0.2042,  0.2008,\n",
      "        -0.1014,  0.3839, -0.4870, -0.4971, -0.0120, -0.5000,  0.4714, -0.0416],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0011, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> init weights: tensor([-0.0016, -0.0003, -0.0005,  0.0016, -0.0016, -0.0016,  0.0015, -0.0016,\n",
      "        -0.0016, -0.0016, -0.0016, -0.0016,  0.0015,  0.0016,  0.0016, -0.0016,\n",
      "         0.0016, -0.0003, -0.0003,  0.0013, -0.0016,  0.0015, -0.0008,  0.0016],\n",
      "       device='cuda:1')\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.57414353/0.6081081\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.56048930/0.6216216\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.54749680/0.6486486\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.53502798/0.6621622\n",
      "####Few Shot 264 | 790 ####, loss/acc = 1.52311981/0.6621622\n",
      "=====> Optimized acc: (tensor(-0.0364, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.4986,  0.4957, -0.5011,  0.4954, -0.4624, -0.4459,  0.4957, -0.5008,\n",
      "        -0.5037, -0.5009, -0.4912, -0.5036,  0.4752,  0.5035,  0.4977, -0.5028,\n",
      "         0.1185,  0.4895,  0.0746,  0.4605, -0.4942,  0.4163, -0.1032,  0.4995],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0830, device='cuda:1'), 0.75, 0.8333333333333334)\n",
      "=====> init weights: tensor([-1.5457e-03, -8.3048e-04, -1.6101e-03, -1.5872e-03,  1.5891e-03,\n",
      "        -1.3483e-03,  1.4148e-03,  1.6313e-03, -1.5297e-03, -1.5918e-03,\n",
      "        -1.5345e-03, -1.6193e-03, -1.6250e-03, -2.6363e-04,  1.5912e-03,\n",
      "        -1.4715e-03, -1.6148e-03, -1.6288e-03,  1.5601e-03,  2.7260e-05,\n",
      "        -9.5738e-04, -1.5609e-03, -1.2527e-03, -1.5853e-03], device='cuda:1')\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.57406497/0.6081081\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.55643213/0.6351351\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.53912997/0.6351351\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.52288020/0.6351351\n",
      "####Few Shot 288 | 790 ####, loss/acc = 1.50714946/0.6216216\n",
      "=====> Optimized acc: (tensor(0.2328, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> Optimized weights: tensor([-0.5022, -0.2348, -0.5008, -0.3749,  0.4941, -0.2568,  0.5015,  0.4965,\n",
      "         0.2148, -0.5032, -0.4918, -0.5026, -0.5008, -0.0358,  0.5017, -0.4097,\n",
      "        -0.5018, -0.5034,  0.4962, -0.4750, -0.4285, -0.4916, -0.4945, -0.5032],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0130, device='cuda:1'), 0.75, 0.75)\n",
      "=====> init weights: tensor([-0.0011, -0.0016, -0.0016, -0.0016,  0.0012, -0.0015,  0.0014, -0.0016,\n",
      "        -0.0016,  0.0006, -0.0016,  0.0014,  0.0015, -0.0012, -0.0007, -0.0009,\n",
      "        -0.0016,  0.0016, -0.0016, -0.0015,  0.0009, -0.0016,  0.0013, -0.0006],\n",
      "       device='cuda:1')\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.57405853/0.6081081\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.55333745/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.53521693/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.51727509/0.6216216\n",
      "####Few Shot 312 | 790 ####, loss/acc = 1.49922037/0.6351351\n",
      "=====> Optimized acc: (tensor(0.0113, device='cuda:1'), 0.8333333333333334, 0.8)\n",
      "=====> Optimized weights: tensor([-0.4413, -0.5026, -0.4769, -0.4916,  0.4118, -0.4459, -0.0055, -0.4993,\n",
      "        -0.4964, -0.2391, -0.4919,  0.4568,  0.1533, -0.3099, -0.5021, -0.1039,\n",
      "        -0.4972,  0.4975, -0.2461, -0.3139, -0.0478, -0.4463,  0.5007, -0.1913],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0944, device='cuda:1'), 0.75, 0.6666666666666666)\n",
      "=====> init weights: tensor([-6.2816e-04, -1.6309e-03,  1.5016e-03,  7.3667e-04, -1.5807e-03,\n",
      "         1.6029e-03, -1.3842e-04, -1.6324e-03,  1.6067e-03, -1.6270e-03,\n",
      "        -1.5066e-03, -1.6328e-03,  1.6002e-03,  1.5904e-03, -5.5230e-04,\n",
      "         1.5666e-03, -1.6230e-03,  8.0145e-05, -1.6267e-03, -1.5643e-03,\n",
      "        -5.0474e-04, -1.6135e-03,  1.5576e-03, -1.5834e-03], device='cuda:1')\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.57415593/0.6081081\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.56433976/0.6486486\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.55206430/0.6351351\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.54139292/0.6351351\n",
      "####Few Shot 336 | 790 ####, loss/acc = 1.53270066/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.0703, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([ 0.1571, -0.5025,  0.3527,  0.3679, -0.5019,  0.4991, -0.4167, -0.4988,\n",
      "         0.4020, -0.4874,  0.1045, -0.4803,  0.4473,  0.4978, -0.4650,  0.4942,\n",
      "        -0.4997,  0.1297, -0.4958, -0.5017,  0.4081, -0.4444,  0.4832, -0.5008],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(-0.2050, device='cuda:1'), 0.8333333333333334, 1.0)\n",
      "=====> init weights: tensor([ 1.4585e-03,  1.5869e-03, -1.6269e-03, -1.6246e-03,  8.9281e-04,\n",
      "        -1.6162e-03, -1.6308e-03,  9.4315e-04, -1.4973e-03,  1.6239e-03,\n",
      "        -1.2784e-03, -1.5754e-03, -1.6317e-03, -1.6301e-03, -1.4288e-03,\n",
      "        -5.1997e-05, -4.1037e-04,  1.1734e-03,  1.6329e-03, -1.6256e-03,\n",
      "        -1.6274e-03, -1.4955e-03, -1.6151e-03, -8.4806e-05], device='cuda:1')\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.57412589/0.6081081\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.55925977/0.6216216\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.54646456/0.6351351\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.53429687/0.6351351\n",
      "####Few Shot 360 | 790 ####, loss/acc = 1.52247655/0.6621622\n",
      "=====> Optimized acc: (tensor(-0.0816, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.4400,  0.4879, -0.5022, -0.4988,  0.4678, -0.5013, -0.5026,  0.4983,\n",
      "         0.0089,  0.4981, -0.5014, -0.0944, -0.5022, -0.5020, -0.4150, -0.4976,\n",
      "        -0.4997,  0.3082,  0.4964, -0.4916, -0.5027, -0.4986, -0.4997, -0.0158],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0788, device='cuda:1'), 1.0, 1.0)\n",
      "=====> init weights: tensor([-0.0016, -0.0016, -0.0015,  0.0005, -0.0015, -0.0016, -0.0016,  0.0016,\n",
      "         0.0011, -0.0014, -0.0016, -0.0016,  0.0008, -0.0016,  0.0016, -0.0016,\n",
      "         0.0008, -0.0016,  0.0002, -0.0006, -0.0004,  0.0014, -0.0016,  0.0014],\n",
      "       device='cuda:1')\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.57420862/0.6081081\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.56550717/0.6216216\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.55765975/0.6351351\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.55045819/0.6621622\n",
      "####Few Shot 384 | 790 ####, loss/acc = 1.54362071/0.6621622\n",
      "=====> Optimized acc: (tensor(0.0573, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-0.5020, -0.3170, -0.5012,  0.2114,  0.0074, -0.4818, -0.4936,  0.4914,\n",
      "         0.4815, -0.3896, -0.5028, -0.5038, -0.4229, -0.4575,  0.1634, -0.0578,\n",
      "        -0.4690, -0.4850,  0.4890,  0.4882,  0.1986,  0.3215, -0.1916,  0.4464],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0156, device='cuda:1'), 0.75, 0.7272727272727273)\n",
      "=====> init weights: tensor([ 0.0005, -0.0004,  0.0001,  0.0016, -0.0015, -0.0016,  0.0010,  0.0005,\n",
      "         0.0016, -0.0005, -0.0016, -0.0010, -0.0013, -0.0016,  0.0016,  0.0006,\n",
      "        -0.0016, -0.0016, -0.0016,  0.0016,  0.0016, -0.0016,  0.0015, -0.0015],\n",
      "       device='cuda:1')\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.57422578/0.6081081\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.56501496/0.6486486\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.55623102/0.6486486\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.54786336/0.6486486\n",
      "####Few Shot 408 | 790 ####, loss/acc = 1.53973651/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.0976, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([ 0.4795,  0.3825, -0.4955,  0.4968, -0.4982, -0.5015,  0.4629, -0.3966,\n",
      "         0.4959, -0.4934, -0.5015, -0.3189, -0.5000, -0.5023,  0.4969, -0.4580,\n",
      "        -0.5036, -0.4989, -0.5004,  0.4811,  0.4995, -0.4967,  0.4955, -0.4963],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1723, device='cuda:1'), 0.6666666666666666, 0.75)\n",
      "=====> init weights: tensor([ 1.5647e-03,  6.0689e-04, -1.6317e-03, -1.5536e-03, -2.5990e-04,\n",
      "        -2.4512e-04, -1.6254e-03, -1.6293e-03,  1.4825e-03, -1.5623e-03,\n",
      "        -6.0055e-05, -1.5906e-03,  1.5105e-03, -1.6216e-03, -3.8306e-04,\n",
      "         6.0344e-04,  1.6252e-03, -5.0652e-04,  8.4604e-04, -1.6166e-03,\n",
      "        -1.6118e-03, -2.7706e-04, -1.6077e-03,  5.3627e-04], device='cuda:1')\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.57411158/0.6081081\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.55718398/0.6351351\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.54265320/0.6486486\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.52849400/0.6486486\n",
      "####Few Shot 432 | 790 ####, loss/acc = 1.51474905/0.6621622\n",
      "=====> Optimized acc: (tensor(0.0109, device='cuda:1'), 0.75, 0.7)\n",
      "=====> Optimized weights: tensor([ 0.3891, -0.1336, -0.5032, -0.4781, -0.4810,  0.3636, -0.5012, -0.5027,\n",
      "         0.5000, -0.3948, -0.0245, -0.5005,  0.4017,  0.0388, -0.3390,  0.4926,\n",
      "         0.4787, -0.4966,  0.4733, -0.5013, -0.1791,  0.4643, -0.4932,  0.2071],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.3176, device='cuda:1'), 0.6666666666666666, 0.6)\n",
      "=====> init weights: tensor([ 1.6103e-03, -1.6250e-03, -1.4017e-04, -5.4906e-05, -6.5959e-05,\n",
      "        -7.9096e-04, -1.6091e-03, -3.3569e-04,  1.4368e-03, -1.2714e-03,\n",
      "         1.6255e-03,  1.5977e-03,  1.2719e-03,  8.5730e-04,  5.6523e-04,\n",
      "        -1.6337e-03, -1.4510e-03,  2.2078e-04,  4.4028e-04, -9.6524e-05,\n",
      "        -1.6224e-03,  1.6064e-03, -1.6133e-03, -1.5094e-03], device='cuda:1')\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.57429528/0.6081081\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.56833303/0.6351351\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.56240284/0.6351351\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.55653691/0.6351351\n",
      "####Few Shot 456 | 790 ####, loss/acc = 1.55076659/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.2473, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([ 0.5026, -0.5031, -0.4463,  0.4977, -0.4997,  0.4419, -0.5020, -0.1799,\n",
      "        -0.1463, -0.4981,  0.4939,  0.5023,  0.4980,  0.4794, -0.4724, -0.5038,\n",
      "        -0.5027, -0.2443,  0.4876, -0.4915, -0.5024,  0.5015, -0.5031, -0.4527],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0316, device='cuda:1'), 0.6666666666666666, 0.6363636363636364)\n",
      "=====> init weights: tensor([ 1.5371e-03, -3.3804e-04, -3.7458e-06, -1.6305e-03, -1.4671e-03,\n",
      "         6.4485e-04, -1.6305e-03, -1.0921e-03,  0.0000e+00, -1.3709e-03,\n",
      "         1.4718e-03, -1.6281e-03, -1.6264e-03, -1.3561e-03,  1.1664e-03,\n",
      "         3.1993e-05,  1.5454e-03,  1.5809e-03,  5.6197e-04,  1.8358e-04,\n",
      "        -1.5867e-03, -1.6196e-03,  1.5993e-03,  4.2847e-04], device='cuda:1')\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.57415199/0.6081081\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.56002271/0.6351351\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.54658926/0.6351351\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.53365064/0.6351351\n",
      "####Few Shot 480 | 790 ####, loss/acc = 1.52145600/0.6351351\n",
      "=====> Optimized acc: (tensor(0.1131, device='cuda:1'), 0.75, 0.625)\n",
      "=====> Optimized weights: tensor([ 0.4814, -0.0922, -0.4712, -0.4337, -0.4877,  0.1753, -0.5030, -0.3349,\n",
      "         0.0000, -0.5031,  0.4668, -0.4829, -0.2431, -0.4089,  0.4530, -0.2126,\n",
      "         0.4957,  0.3088,  0.2775, -0.1103, -0.4642, -0.5002,  0.4987, -0.0850],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1802, device='cuda:1'), 0.9166666666666666, 0.8571428571428571)\n",
      "=====> init weights: tensor([-0.0016,  0.0013, -0.0013, -0.0016, -0.0016,  0.0016, -0.0016,  0.0016,\n",
      "        -0.0015, -0.0014,  0.0016, -0.0016,  0.0012, -0.0016, -0.0016, -0.0014,\n",
      "        -0.0016, -0.0012, -0.0005,  0.0010, -0.0014, -0.0011,  0.0008, -0.0016],\n",
      "       device='cuda:1')\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.57424045/0.6081081\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.56917071/0.6216216\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.56576514/0.6351351\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.56182516/0.6486486\n",
      "####Few Shot 504 | 790 ####, loss/acc = 1.55870318/0.6351351\n",
      "=====> Optimized acc: (tensor(0.0110, device='cuda:1'), 0.8333333333333334, 0.9)\n",
      "=====> Optimized weights: tensor([-0.1204, -0.2326,  0.2314,  0.1082, -0.4988, -0.0079,  0.1214,  0.4782,\n",
      "         0.2245, -0.4935,  0.4837, -0.4967,  0.2925, -0.4870, -0.4898, -0.4259,\n",
      "        -0.4822, -0.3656, -0.4926,  0.2856, -0.4630,  0.1981,  0.1731, -0.0016],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.1781, device='cuda:1'), 0.6666666666666666, 0.625)\n",
      "=====> init weights: tensor([-0.0016,  0.0016,  0.0001, -0.0002,  0.0016, -0.0006, -0.0015,  0.0016,\n",
      "        -0.0016, -0.0016, -0.0016, -0.0011, -0.0016, -0.0015, -0.0015, -0.0003,\n",
      "        -0.0006,  0.0015, -0.0015, -0.0016,  0.0016,  0.0010,  0.0009, -0.0008],\n",
      "       device='cuda:1')\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.57418561/0.6081081\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.56186795/0.6216216\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 528 | 790 ####, loss/acc = 1.55103290/0.6351351\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.54097378/0.6216216\n",
      "####Few Shot 528 | 790 ####, loss/acc = 1.53188753/0.6216216\n",
      "=====> Optimized acc: (tensor(0.2058, device='cuda:1'), 0.6666666666666666, 0.75)\n",
      "=====> Optimized weights: tensor([-0.4919,  0.4956, -0.2651, -0.4997,  0.4518, -0.4828, -0.4892,  0.4994,\n",
      "        -0.4930, -0.5014, -0.5012, -0.3431, -0.4104, -0.4681, -0.4490, -0.3306,\n",
      "         0.3775,  0.4780, -0.4473, -0.4991,  0.4723,  0.4895,  0.4926, -0.1595],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1555, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> init weights: tensor([ 0.0007, -0.0014, -0.0016, -0.0016, -0.0016, -0.0016,  0.0015, -0.0005,\n",
      "        -0.0016,  0.0016, -0.0016, -0.0008, -0.0009, -0.0016, -0.0016,  0.0016,\n",
      "         0.0016, -0.0012, -0.0016,  0.0016,  0.0016,  0.0006, -0.0008, -0.0009],\n",
      "       device='cuda:1')\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.57426429/0.6081081\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.56792545/0.6351351\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.56134999/0.6351351\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.55506778/0.6351351\n",
      "####Few Shot 552 | 790 ####, loss/acc = 1.54915345/0.6621622\n",
      "=====> Optimized acc: (tensor(-0.2418, device='cuda:1'), 0.75, 0.875)\n",
      "=====> Optimized weights: tensor([ 0.4744, -0.4729, -0.4906, -0.5016, -0.5005, -0.4991,  0.4790, -0.4877,\n",
      "        -0.5024,  0.4672, -0.5032, -0.5020, -0.4726, -0.5030, -0.4984,  0.4979,\n",
      "         0.4964, -0.4975, -0.5030,  0.5034,  0.4017,  0.1318, -0.0946, -0.0323],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.2244, device='cuda:1'), 0.6666666666666666, 0.8333333333333334)\n",
      "=====> init weights: tensor([-0.0015, -0.0016, -0.0015,  0.0007, -0.0008, -0.0016,  0.0015, -0.0016,\n",
      "        -0.0014, -0.0016, -0.0016, -0.0016, -0.0010,  0.0015,  0.0016, -0.0003,\n",
      "        -0.0016, -0.0016, -0.0006,  0.0015, -0.0015, -0.0013, -0.0016,  0.0014],\n",
      "       device='cuda:1')\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.57423413/0.6081081\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.56694674/0.6216216\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.56048071/0.6351351\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.55439913/0.6351351\n",
      "####Few Shot 576 | 790 ####, loss/acc = 1.54820728/0.6351351\n",
      "=====> Optimized acc: (tensor(0.2390, device='cuda:1'), 0.75, 0.8)\n",
      "=====> Optimized weights: tensor([-0.4770, -0.5026, -0.5025,  0.2875, -0.0944, -0.5021,  0.4669, -0.4882,\n",
      "        -0.4782, -0.5013, -0.5030, -0.4999, -0.3335,  0.4913,  0.4735, -0.4590,\n",
      "        -0.5032, -0.5031, -0.4877,  0.4828, -0.4933, -0.5023, -0.5021, -0.2443],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.1221, device='cuda:1'), 0.9166666666666666, 0.9090909090909091)\n",
      "=====> init weights: tensor([ 5.0188e-04, -1.6145e-03,  3.5085e-04,  4.6934e-05, -4.1648e-04,\n",
      "        -1.6331e-03,  1.5406e-03,  5.7990e-04,  4.1966e-04, -1.6070e-03,\n",
      "        -5.2666e-04, -1.2576e-03, -1.6040e-03, -1.6272e-03,  8.3935e-04,\n",
      "         1.1084e-03, -1.5836e-03, -8.2580e-04, -1.5504e-03, -1.6287e-03,\n",
      "        -1.2889e-03,  1.6015e-03,  3.0152e-04,  1.2674e-03], device='cuda:1')\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.57413960/0.6081081\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.55642128/0.6351351\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.54026330/0.6351351\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.52567577/0.6486486\n",
      "####Few Shot 600 | 790 ####, loss/acc = 1.51132762/0.6486486\n",
      "=====> Optimized acc: (tensor(-0.0171, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-0.5000, -0.4984, -0.3409,  0.3856,  0.4250, -0.5030,  0.4935, -0.4781,\n",
      "         0.5013, -0.4991,  0.4540, -0.4904, -0.4754, -0.4954,  0.4981,  0.4972,\n",
      "        -0.5009, -0.1136, -0.4995, -0.5034, -0.4810,  0.4756, -0.4932, -0.0283],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0411, device='cuda:1'), 0.75, 0.6666666666666666)\n",
      "=====> init weights: tensor([-1.6309e-03,  1.4677e-03, -1.6302e-03,  2.5090e-04, -1.5726e-03,\n",
      "        -7.6725e-04, -1.5668e-03, -1.5436e-03,  7.6132e-05, -5.4185e-04,\n",
      "        -1.6324e-03,  1.3753e-03,  1.5966e-03,  1.6688e-04, -1.4874e-03,\n",
      "        -1.5113e-03, -5.0900e-04, -1.5863e-03,  1.4940e-03,  0.0000e+00,\n",
      "        -1.5903e-03,  1.6099e-03,  1.6182e-03, -1.6321e-03], device='cuda:1')\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.57404923/0.6081081\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.56326675/0.6216216\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.55286872/0.6216216\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.54066050/0.6216216\n",
      "####Few Shot 624 | 790 ####, loss/acc = 1.52911472/0.6081081\n",
      "=====> Optimized acc: (tensor(0.1213, device='cuda:1'), 0.6666666666666666, 0.6)\n",
      "=====> Optimized weights: tensor([ 0.0719,  0.4440, -0.3472,  0.2275,  0.0702, -0.4870, -0.1215, -0.4849,\n",
      "         0.1965, -0.1640, -0.3405, -0.1103, -0.1299,  0.4501, -0.4901, -0.4600,\n",
      "         0.4773, -0.4869,  0.4682,  0.0000, -0.5015,  0.4864,  0.4825, -0.5003],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.0779, device='cuda:1'), 0.5833333333333334, 0.5555555555555556)\n",
      "=====> init weights: tensor([ 1.6168e-03, -6.3882e-04,  1.5839e-03, -6.9723e-04, -1.1277e-04,\n",
      "        -1.5627e-03,  1.4613e-03, -1.6300e-03, -1.5642e-03, -1.6071e-03,\n",
      "        -1.6200e-03,  1.6991e-04, -1.5800e-03, -5.7447e-04,  7.4322e-04,\n",
      "         1.6014e-03, -4.9678e-04, -1.1699e-04, -3.9388e-04, -7.6450e-05,\n",
      "         1.3944e-03,  1.5310e-03,  1.0656e-03, -1.6257e-03], device='cuda:1')\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.57409501/0.6081081\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.55725384/0.6216216\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.54107642/0.6216216\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.52482104/0.6216216\n",
      "####Few Shot 648 | 790 ####, loss/acc = 1.50851047/0.6216216\n",
      "=====> Optimized acc: (tensor(0.1004, device='cuda:1'), 0.6666666666666666, 0.5555555555555556)\n",
      "=====> Optimized weights: tensor([ 0.4992, -0.1809,  0.3647, -0.4945, -0.3857, -0.4867, -0.1397, -0.5033,\n",
      "        -0.4875, -0.5022, -0.4968, -0.3941, -0.5003, -0.2545,  0.1632,  0.4973,\n",
      "         0.4114, -0.4551,  0.3547, -0.0176,  0.5013,  0.4556,  0.1410, -0.5022],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.3205, device='cuda:1'), 0.75, 0.75)\n",
      "=====> init weights: tensor([-1.6138e-03,  1.1613e-03,  1.4959e-03, -1.6035e-03, -6.6352e-04,\n",
      "         1.5859e-03,  1.8702e-05, -6.8680e-06,  1.3185e-03, -1.0863e-03,\n",
      "         1.5686e-03,  1.5897e-03, -1.6241e-03,  7.1782e-04, -1.6109e-03,\n",
      "        -1.6108e-03, -1.6212e-03, -1.5620e-03, -1.6069e-03, -1.6264e-03,\n",
      "        -3.6489e-04, -1.5638e-03, -1.6328e-03, -1.6183e-03], device='cuda:1')\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.57423747/0.6081081\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.56715000/0.6216216\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.56168377/0.6216216\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.55647385/0.6216216\n",
      "####Few Shot 672 | 790 ####, loss/acc = 1.55086088/0.6216216\n",
      "=====> Optimized acc: (tensor(-0.2915, device='cuda:1'), 0.75, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.4923,  0.4790,  0.4741, -0.4515,  0.4660,  0.4665, -0.1674,  0.2225,\n",
      "         0.1845, -0.4744,  0.4913,  0.4467, -0.4965,  0.1615, -0.4911, -0.4775,\n",
      "        -0.5014, -0.4902, -0.4909, -0.3750, -0.1753, -0.5030, -0.5014, -0.4998],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.0483, device='cuda:1'), 0.9166666666666666, 0.8571428571428571)\n",
      "=====> init weights: tensor([ 0.0016, -0.0015, -0.0015, -0.0016, -0.0016,  0.0015,  0.0000, -0.0016,\n",
      "         0.0016,  0.0015, -0.0016, -0.0012,  0.0016, -0.0016, -0.0016, -0.0016,\n",
      "        -0.0010, -0.0014,  0.0015, -0.0002,  0.0016, -0.0011, -0.0016, -0.0016],\n",
      "       device='cuda:1')\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.57419109/0.6081081\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.56501961/0.6216216\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.55719388/0.6081081\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.55043423/0.6081081\n",
      "####Few Shot 696 | 790 ####, loss/acc = 1.54394603/0.6081081\n",
      "=====> Optimized acc: (tensor(0.2474, device='cuda:1'), 0.9166666666666666, 0.9)\n",
      "=====> Optimized weights: tensor([ 0.4707,  0.1194,  0.4226, -0.4834, -0.4705,  0.4997,  0.0000, -0.4955,\n",
      "         0.4945,  0.4967, -0.4836, -0.3519,  0.0996, -0.4549, -0.5030, -0.5023,\n",
      "        -0.4727, -0.4611,  0.4939, -0.0500,  0.4572, -0.3274,  0.1564, -0.1521],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(-0.2253, device='cuda:1'), 0.8333333333333334, 0.7777777777777778)\n",
      "=====> init weights: tensor([-1.5541e-03, -1.6293e-03, -1.6337e-03, -1.6199e-03,  1.5224e-03,\n",
      "         1.6324e-03,  9.5279e-05,  6.0294e-04,  4.7931e-04, -6.2565e-04,\n",
      "        -1.3352e-03,  1.5733e-03,  1.3499e-03,  6.5483e-05, -1.8986e-04,\n",
      "         1.3247e-03, -6.9812e-04, -1.6092e-03, -1.6074e-03, -5.8533e-04,\n",
      "        -1.6124e-03, -7.3116e-04, -1.6199e-03, -1.6289e-03], device='cuda:1')\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.57414067/0.6081081\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.55914962/0.6081081\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.54498625/0.6216216\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.53091407/0.6216216\n",
      "####Few Shot 720 | 790 ####, loss/acc = 1.51769626/0.6351351\n",
      "=====> Optimized acc: (tensor(-0.1268, device='cuda:1'), 0.8333333333333334, 0.8)\n",
      "=====> Optimized weights: tensor([-0.5004, -0.4974, -0.5031, -0.4996,  0.3847,  0.4993,  0.0189, -0.0615,\n",
      "         0.4641, -0.4912, -0.1510,  0.4205,  0.4954,  0.4286, -0.3842,  0.4891,\n",
      "         0.3299, -0.4992, -0.4979, -0.4972, -0.5031,  0.1392, -0.4939, -0.4977],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(0.5836, device='cuda:1'), 1.0, 1.0)\n",
      "=====> init weights: tensor([-1.1410e-03, -1.6157e-03, -1.5894e-03, -1.6332e-03, -1.6246e-03,\n",
      "        -1.6152e-03, -1.4288e-03,  9.6634e-04, -1.6191e-03,  1.5614e-03,\n",
      "         1.5626e-03,  1.5592e-03, -5.6509e-04, -1.4701e-03, -1.6265e-03,\n",
      "         1.5738e-03, -1.7942e-05, -1.6000e-03,  1.5720e-03,  1.6039e-03,\n",
      "        -3.7648e-04, -1.6294e-03,  1.6227e-03, -1.6080e-03], device='cuda:1')\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.57394898/0.6081081\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.54740095/0.6081081\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.52314651/0.6216216\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.50086498/0.6351351\n",
      "####Few Shot 744 | 790 ####, loss/acc = 1.47874713/0.6486486\n",
      "=====> Optimized acc: (tensor(0.6376, device='cuda:1'), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([-0.2351, -0.5020, -0.5023, -0.5005, -0.5036, -0.5018, -0.3821,  0.3710,\n",
      "        -0.5009,  0.5004,  0.4805,  0.4870, -0.1838, -0.4958, -0.4961,  0.4980,\n",
      "         0.3626, -0.5018,  0.1999,  0.4754,  0.4999, -0.4469,  0.5033, -0.4875],\n",
      "       device='cuda:1')\n",
      "=====> init acc: (tensor(-0.9514, device='cuda:1'), 0.8333333333333334, 0.8888888888888888)\n",
      "=====> init weights: tensor([ 1.6139e-03,  1.4252e-03,  4.1928e-04,  1.5670e-03,  1.5928e-03,\n",
      "         5.0385e-04, -1.6278e-03, -1.6243e-03,  1.5730e-03, -1.6166e-03,\n",
      "        -8.7540e-04, -1.4066e-03,  1.4535e-03, -1.6192e-03, -1.6171e-03,\n",
      "         1.4547e-03, -2.3235e-05, -1.6338e-03, -1.6060e-03, -1.4788e-03,\n",
      "        -1.6225e-03, -1.0807e-03, -4.7149e-01, -2.1982e-01], device='cuda:1')\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.57387853/0.6216216\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.56781542/0.6351351\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.56300330/0.6216216\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.55775750/0.6081081\n",
      "####Few Shot 768 | 790 ####, loss/acc = 1.55214190/0.6216216\n",
      "=====> Optimized acc: (tensor(0.1041, device='cuda:1'), 0.9166666666666666, 0.9)\n",
      "=====> Optimized weights: tensor([ 3.8857e-01,  2.1903e-01,  1.3096e-01,  4.1433e-01,  4.9919e-01,\n",
      "         4.4506e-01, -5.0067e-01, -5.0290e-01,  4.9138e-01, -4.7157e-01,\n",
      "        -3.8439e-01, -4.5655e-01,  4.8138e-01, -5.0289e-01, -4.9514e-01,\n",
      "         4.5788e-01, -2.3235e-05, -5.0170e-01, -4.9768e-01,  8.1853e-04,\n",
      "        -4.9847e-01, -4.6862e-01, -9.6226e-01, -1.1685e-01], device='cuda:1')\n"
     ]
    }
   ],
   "source": [
    "tmp = (DVA.lr4model, DVA.scale_lr4model)\n",
    "DVA.lr4model, DVA.scale_lr4model = 1e-1, 2e-2\n",
    "DVA.Evaluate(max_epochs=3, max_meta_steps=5, lr4weights=0.1) # ferguson 上是0.1, sydney上是0.05\n",
    "DVA.lr4model, DVA.scale_lr4model = tmp[0], tmp[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "790\n",
      "tensor(290)\n",
      "(tensor(0.4354), 0.739240506329114, 0.7177215189873418)\n",
      "(tensor(0.0352), 0.8025316455696202, 0.7965517241379311)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(tensor(0.4741, device='cuda:0'), tensor(0.5345, device='cuda:0'))"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1),\n",
    "            torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1),\n",
    "            torch.ones([len(indices)]))\n",
    "     )\n",
    "print(WeightedAcc(torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1),\n",
    "            torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1),\n",
    "            DVA.weak_set_weights[indices])\n",
    "    )\n",
    "e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "820\n",
      "tensor(353)\n",
      "(tensor(0.3707), 0.6585365853658537, 0.6853658536585366)\n",
      "(tensor(0.0614), 0.7682926829268293, 0.7507082152974505)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(tensor(0.2297, device='cuda:0'), tensor(0.2435, device='cuda:0'))"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1),\n",
    "            torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1),\n",
    "            torch.ones([len(indices)]))\n",
    "     )\n",
    "print(WeightedAcc(torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1),\n",
    "            torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1),\n",
    "            DVA.weak_set_weights[indices])\n",
    "     )\n",
    "e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1043\n",
      "tensor(929)\n",
      "(tensor(0.5168), 0.7677543186180422, 0.7583892617449665)\n",
      "(tensor(0.5864), 0.8272552783109405, 0.7804090419806243)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(tensor(0.3402, device='cuda:0'), tensor(0.3349, device='cuda:0'))"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "indices = torch.arange(DVA.weak_set_size)#[DVA.weak_set_weights.__gt__(0.0)]\n",
    "print(len(indices))\n",
    "print(DVA.weak_set_weights.__gt__(0.0).int().sum())\n",
    "print(WeightedAcc(torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1),\n",
    "            torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1),\n",
    "            torch.ones([len(indices)]))\n",
    "     )\n",
    "print(WeightedAcc(torch.tensor(DVA.weak_set_label)[indices].argmax(dim=1),\n",
    "            torch.tensor(DVA.weak_set.data_y)[indices].argmax(dim=1),\n",
    "            DVA.weak_set_weights[indices])\n",
    "     )\n",
    "e_arr.mean(), e_arr[DVA.weak_set_weights.__gt__(0.0)].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor(338), 845)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "torch.tensor(DVA.weak_set.data_y).argmax(dim=1)[DVA.weak_set_weights.__gt__(0.0)].sum(), len(torch.tensor(DVA.weak_set.data_y).argmax(dim=1)[DVA.weak_set_weights.__gt__(0.0)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import recall_score, precision_score, f1_score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "pos_indices = DVA.weak_set_weights.__gt__(0.0)\n",
    "weak_label = torch.tensor(DVA.weak_set.data_y).argmax(dim=1)[pos_indices]\n",
    "true_label = torch.tensor(DVA.weak_set_label).argmax(dim=1)[pos_indices]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.7029585798816568,\n",
       " 0.41124260355029585,\n",
       " 0.7277486910994765,\n",
       " 0.5255198487712666)"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "accuracy_score(true_label, weak_label), precision_score(true_label, weak_label), recall_score(true_label, weak_label), f1_score(true_label, weak_label)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```python \n",
    "def cmd_proc(cmd):\n",
    "    os.system(cmd)\n",
    "    \n",
    "def Evaluate(self, max_epochs=10, max_meta_steps=10, lr4weights=1.0, n_proc=4):\n",
    "    few_shot_data = self.few_shot_set.collate_raw_batch(\n",
    "        [self.few_shot_set[i] for i in range(len(self.few_shot_set))]\n",
    "    )\n",
    "    self.weak_set_weights = torch.zeros(len(self.weak_set))\n",
    "    with open(\"model.pkl\", 'wb') as fw:\n",
    "        pickle.dump(self.model, fw, protocol=pickle.HIGHEST_PROTOCOL)\n",
    "    with open(\"few_shot_data.pkl\", 'wb') as fw:\n",
    "        pickle.dump(few_shot_data, fw, protocol=pickle.HIGHEST_PROTOCOL)\n",
    "    for epoch in range(max_epochs):\n",
    "        with open(\"all_weights.pkl\", 'wb') as fw:\n",
    "            pickle.dump(self.weak_set_weights, fw, protocol=pickle.HIGHEST_PROTOCOL)\n",
    "        shuffled_indices = random.sample(list(range(len(self.weak_set))), \n",
    "                                         len(self.weak_set)) * 2\n",
    "        lr4weights = max(lr4weights*(0.5**epoch), 0.1)\n",
    "        collected_weight_files = []\n",
    "        pool = []\n",
    "        for step in range(0, len(self.weak_set), self.batch_size):\n",
    "            indices = shuffled_indices[step:step + self.batch_size]\n",
    "            batch, indices = self.InnerBatch(indices)\n",
    "            indices = indices.cpu()\n",
    "            with open(\"batch_%d.pkl\"%step, 'wb') as fw:\n",
    "                pickle.dump(batch, fw, protocol=pickle.HIGHEST_PROTOCOL)\n",
    "            with open(\"indices_%d.pkl\"%step, 'wb') as fw:\n",
    "                pickle.dump(indices, fw, protocol=pickle.HIGHEST_PROTOCOL)\n",
    "            collected_weight_files.append(\"weak_set_weights_%d.npy\"%step)\n",
    "            print(\"=====> init acc:\",WeightedAcc(torch.tensor(self.weak_set_label)[indices].argmax(dim=1),\n",
    "                                                torch.tensor(self.weak_set.data_y)[indices].argmax(dim=1),\n",
    "                                                self.weak_set_weights[indices] ))\n",
    "            print(\"=====> init weights:\", self.weak_set_weights[indices])\n",
    "            p = mp.Process(target=cmd_proc, args=(\"python evaluate.py --proc_id %d --weak_set_size %d\\\n",
    "                        --batch_pkl batch_%d.pkl \\\n",
    "                        --indices_pkl indices_%d.pkl --model_pkl model.pkl \\\n",
    "                        --few_shot_data_pkl few_shot_data.pkl \\\n",
    "                        --weights_pkl all_weights.pkl\"%(step, len(self.weak_set), step, step),))\n",
    "            pool.append(p)\n",
    "            if len(collected_weight_files)==n_proc:\n",
    "                for p in pool:\n",
    "                    p.start()\n",
    "                for p in pool:\n",
    "                    p.join()\n",
    "                pool = []\n",
    "                self.weak_set_weights = torch.tensor(\n",
    "                            [np.load(npy_file).tolist() \n",
    "                            for npy_file in collected_weight_files]\n",
    "                ).sum(dim=0)\n",
    "                indices = shuffled_indices[step - (n_proc-1)*self.batch_size:step+self.batch_size]\n",
    "                print(\"=====> Optimized acc:\",WeightedAcc(\n",
    "                            torch.tensor(self.weak_set_label)[indices].argmax(dim=1),\n",
    "                            torch.tensor(self.weak_set.data_y)[indices].argmax(dim=1),\n",
    "                            self.weak_set_weights[indices]\n",
    "                          ))\n",
    "                print(\"=====> Optimized weights:\", self.weak_set_weights[indices])\n",
    "                collected_weight_files = []\n",
    "                os.system(\"rm weak_set_weights_*.npy\")\n",
    "        self.weak_set_weights = self.weak_set_weights / self.weak_set_weights.abs().sum()\n",
    "    os.system(\"rm model.pkl\" )\n",
    "    os.system(\"rm few_shot_data.pkl\" )\n",
    "    os.system(\"rm all_weights.pkl\" )\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(nan), 0.5833333333333334, 0.5833333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.4889), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-0.0095,  1.5801, -1.4283,  0.6713,  1.0584, -1.9615, -1.9886,  0.8601,\n",
      "         0.5316, -1.9541, -1.8630,  1.6087,  0.6264, -0.8876, -1.9875,  0.8185,\n",
      "        -1.9236,  0.8848, -2.0075,  1.4081, -0.8245,  0.2714,  1.8778, -2.0219])\n",
      "=====> init acc: (tensor(nan), 0.9166666666666666, 0.7916666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3211), 0.8333333333333334, 0.875)\n",
      "=====> Optimized weights: tensor([ 1.2044, -1.1741,  1.0502, -1.3162,  0.7010, -1.3856,  0.9560,  0.9331,\n",
      "         0.6807,  1.0966, -0.9064,  1.1484,  1.0415,  1.6009,  1.0693,  0.8250,\n",
      "        -0.6563, -0.5620, -1.7794,  0.0881,  1.6048, -1.8294,  0.5873,  1.2319])\n",
      "=====> init acc: (tensor(nan), 0.75, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.4671), 0.8333333333333334, 0.8461538461538461)\n",
      "=====> Optimized weights: tensor([ 0.8930,  1.7150,  0.4762, -0.3629, -0.6797, -1.7649,  0.2124, -0.1732,\n",
      "         1.7714,  1.6990, -0.8363,  1.5352, -0.1237, -0.4778, -0.8305,  1.4235,\n",
      "        -0.9024,  0.5392, -1.9053, -1.3468,  0.1650,  0.9782,  1.8170,  0.6067])\n",
      "=====> init acc: (tensor(nan), 0.75, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.2544), 0.8333333333333334, 0.8)\n",
      "=====> Optimized weights: tensor([-1.9981,  1.9733,  1.2745, -1.9655,  0.0891,  1.9666,  1.9915, -2.0053,\n",
      "         0.0000,  0.3683, -1.9998, -2.0113, -0.8759, -1.9883, -2.0096,  1.9532,\n",
      "         1.1119, -1.8637,  1.9413, -0.6680,  1.0498, -2.0132, -0.7750, -2.0164])\n",
      "=====> init acc: (tensor(nan), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(-0.0782), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-1.7241, -0.2554, -0.4259,  0.0145, -0.6713,  0.1813,  0.9167, -0.7028,\n",
      "        -0.9472, -0.7470, -1.2753, -1.6443, -1.8996, -1.2117, -0.3884,  1.0617,\n",
      "         1.6264, -1.2887,  1.1226,  1.6339, -1.7348,  0.4695, -1.8985,  1.8289])\n",
      "=====> init acc: (tensor(nan), 0.9166666666666666, 0.8333333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3721), 1.0, 0.8666666666666667)\n",
      "=====> Optimized weights: tensor([-1.7759,  1.4330,  1.5557,  0.3613,  1.7593,  1.8965,  1.4404, -0.4508,\n",
      "        -1.8880,  0.6412, -1.8946, -1.1179,  1.8182,  1.1600, -0.2744, -0.5331,\n",
      "         0.8113,  1.3340,  0.9483,  1.4992, -1.0453,  1.6987, -1.5087,  1.7925])\n",
      "=====> init acc: (tensor(nan), 0.8333333333333334, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.5463), 0.9166666666666666, 0.9230769230769231)\n",
      "=====> Optimized weights: tensor([-0.4843,  1.0448,  1.3693,  1.6501,  1.5138,  1.5269, -1.8470,  1.2277,\n",
      "        -0.3147, -1.8521,  1.9083,  1.8191,  1.6321,  1.8147, -0.4461, -0.7040,\n",
      "        -1.8891, -0.6264, -1.3725,  0.8725, -1.9239,  0.1381, -0.2375,  1.1999])\n",
      "=====> init acc: (tensor(nan), 0.9166666666666666, 0.875)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.6086), 0.9166666666666666, 0.9444444444444444)\n",
      "=====> Optimized weights: tensor([-0.1035, -0.9354,  0.9235,  1.5675,  0.4272, -0.2104,  1.1832,  1.3720,\n",
      "         0.3844,  0.4254,  1.7223,  0.7647,  1.1119,  1.1664,  1.1332,  1.2996,\n",
      "         1.1904,  0.2709,  1.4730, -1.6742, -1.0355,  0.9850, -1.1595,  1.0904])\n",
      "=====> init acc: (tensor(nan), 0.5833333333333334, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.1642), 0.8333333333333334, 1.0)\n",
      "=====> Optimized weights: tensor([-2.0201, -1.9943,  1.3453, -0.4496,  0.4587, -2.0151, -2.0034,  1.8117,\n",
      "        -2.0223,  1.9868, -1.5831,  1.6969,  0.6159, -1.6561, -2.0136, -2.0120,\n",
      "        -1.7344, -1.9683,  1.9191, -1.8597,  1.8639, -2.0134, -1.9432, -2.0272])\n",
      "=====> init acc: (tensor(nan), 0.6666666666666666, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.5625), 0.8333333333333334, 0.8235294117647058)\n",
      "=====> Optimized weights: tensor([-0.2809,  1.0782, -1.9101,  0.9233,  0.8566, -1.8391, -1.6089,  1.6265,\n",
      "         1.1291, -1.8950,  0.4674,  1.2982,  0.4051,  0.9980,  1.1935, -1.3966,\n",
      "         1.1980,  1.5890, -1.9548,  1.0686,  1.1726,  1.4260,  1.7841,  0.8807])\n",
      "=====> init acc: (tensor(nan), 0.5833333333333334, 0.625)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3530), 0.9166666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-0.7710,  0.5492, -0.2218,  1.0115,  0.8202,  1.4562,  1.4876,  0.3592,\n",
      "         0.7948,  0.4983,  1.3719, -1.2419,  0.2933,  0.6538,  0.8934,  0.9407,\n",
      "        -0.9769, -0.8597,  1.0774,  1.2820,  0.9156, -1.6410,  0.5610,  1.5743])\n",
      "=====> init acc: (tensor(nan), 0.5833333333333334, 0.625)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.4117), 0.75, 0.7058823529411765)\n",
      "=====> Optimized weights: tensor([-1.9167, -1.9346,  0.6859,  1.4410, -1.7484,  0.7032,  0.5144,  0.6695,\n",
      "         0.8363,  1.1353,  1.4175,  0.5293, -1.9253,  1.2625,  0.1300,  0.2104,\n",
      "         1.1590,  0.4185, -0.7831, -0.1395,  1.1442,  0.6516, -0.1018,  1.3920])\n",
      "=====> init acc: (tensor(nan), 0.6666666666666666, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3056), 0.9166666666666666, 0.9090909090909091)\n",
      "=====> Optimized weights: tensor([-0.3523, -1.8885, -2.0176,  0.1857,  0.0892, -2.0217,  1.0749, -1.0628,\n",
      "        -1.8961,  0.7310, -0.4899,  1.0896, -2.0187,  0.3006, -2.0175,  1.0507,\n",
      "         1.2854,  1.1092, -0.7256, -0.9682, -0.1493, -0.0372,  1.2360,  1.6600])\n",
      "=====> init acc: (tensor(nan), 0.75, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.8308), 0.9166666666666666, 0.9375)\n",
      "=====> Optimized weights: tensor([ 1.5108, -1.7171, -1.6956,  0.4211,  1.5539,  0.0199,  0.9536,  0.1509,\n",
      "         0.7595,  1.1788,  0.3053,  1.0178,  0.7826, -1.6140, -0.5132, -0.0086,\n",
      "         1.0142,  0.4030,  1.0978, -0.5096,  1.4388,  1.2319, -0.7874,  0.0000])\n",
      "=====> init acc: (tensor(nan), 0.4166666666666667, 0.5)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.4885), 0.6666666666666666, 0.6428571428571429)\n",
      "=====> Optimized weights: tensor([-0.2546,  1.0625, -0.3957,  0.1586, -0.0992, -1.9770, -0.1247,  1.1108,\n",
      "        -1.9894,  1.7153, -1.8770,  1.2322,  0.8263,  1.2580,  0.3521,  0.1484,\n",
      "         0.6720,  0.7871,  0.7274, -1.3364,  0.7395, -1.9928,  1.7410, -0.7300])\n",
      "=====> init acc: (tensor(nan), 0.75, 0.7916666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3294), 0.9166666666666666, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([ 1.0275,  0.8455, -1.2920, -1.8540, -0.7500,  0.1494,  1.9032, -1.6147,\n",
      "         1.3396,  1.1631,  1.7822, -1.8610,  0.0978,  1.0343, -0.3783,  0.3489,\n",
      "         1.4452, -0.4143,  0.9521, -0.7258,  0.9600,  0.1965, -1.4180, -1.7551])\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(nan), 0.5833333333333334, 0.625)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.1793), 0.75, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([-1.6450,  1.8179, -1.8390, -1.8345, -2.0011, -2.0141, -1.8256,  0.9321,\n",
      "        -2.0291,  1.6004, -1.8579, -1.9352,  1.2884, -0.2567, -1.4267, -0.9558,\n",
      "        -0.2234,  1.9436, -1.7970, -1.4472,  0.1345,  1.8513, -2.0004, -1.9154])\n",
      "=====> init acc: (tensor(nan), 0.5, 0.625)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.0521), 0.6666666666666666, 0.7)\n",
      "=====> Optimized weights: tensor([-1.7252,  0.6427, -2.0217,  1.4587, -1.9168,  1.9525, -1.8915, -2.0112,\n",
      "         1.6819, -1.9948,  0.0107, -1.9596, -1.9899, -2.0085,  0.5984, -1.8886,\n",
      "         1.6068, -1.9786, -1.7631, -1.4094,  1.5965, -1.7575,  1.8483,  1.1841])\n",
      "=====> init acc: (tensor(nan), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3415), 0.8333333333333334, 0.8461538461538461)\n",
      "=====> Optimized weights: tensor([-1.7775, -1.9895,  0.8589, -1.7639,  0.8223,  0.7389,  1.6426,  1.2082,\n",
      "        -0.1143,  0.6038, -1.3390,  1.1718,  1.8834, -0.4025,  0.5915, -1.2177,\n",
      "         1.6679,  0.8402, -1.6799,  1.5977, -1.1017, -1.5036,  1.6105, -1.9616])\n",
      "=====> init acc: (tensor(nan), 0.8333333333333334, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.7297), 0.9166666666666666, 0.875)\n",
      "=====> Optimized weights: tensor([ 1.1452, -0.0488, -0.7582,  0.3014,  0.8701,  0.0523, -1.0958, -1.2691,\n",
      "         0.3209,  1.0723,  0.4231,  0.2767,  1.6952,  0.9145,  0.9590, -1.5693,\n",
      "         1.1047, -0.2188, -0.8604, -0.4104,  0.7362,  1.0182,  1.1906,  0.5809])\n",
      "=====> init acc: (tensor(nan), 0.6666666666666666, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3164), 0.9166666666666666, 0.9230769230769231)\n",
      "=====> Optimized weights: tensor([-1.8853e-01,  1.0558e+00, -1.9161e+00, -1.7010e+00, -1.1135e+00,\n",
      "         2.1040e-01, -1.9771e+00, -1.8554e+00,  6.8461e-01,  7.4078e-01,\n",
      "         1.4482e+00, -7.3274e-01,  4.8697e-01,  8.4572e-01, -1.2841e+00,\n",
      "         1.5082e+00, -1.9438e+00,  1.4431e+00, -1.9052e+00,  1.6688e-03,\n",
      "        -1.1149e+00,  1.9460e-02,  8.4553e-02,  1.8163e-02])\n",
      "=====> init acc: (tensor(nan), 0.75, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3625), 0.9166666666666666, 0.8888888888888888)\n",
      "=====> Optimized weights: tensor([-2.0250,  1.9076, -1.8174, -0.7367,  0.5003, -1.9680,  1.9429, -2.0214,\n",
      "         1.8837,  1.9333, -1.3364, -2.0218, -1.8773, -1.7577, -2.0076, -1.6096,\n",
      "         0.0000, -2.0189,  1.0485,  1.2142,  1.6544, -1.0562,  1.9061, -1.8107])\n",
      "=====> init acc: (tensor(nan), 0.9166666666666666, 0.8333333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(-0.0436), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([ 1.6806, -1.2829,  0.0759, -0.7590, -1.9486,  0.8545,  0.5022,  0.7115,\n",
      "         1.1148,  0.6429, -0.4241, -1.8861, -1.3881,  1.3094, -1.2051, -0.9192,\n",
      "        -2.0023, -1.9316, -1.8180, -1.0588,  1.7258,  0.8026,  0.9299,  0.9870])\n",
      "=====> init acc: (tensor(nan), 0.8333333333333334, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.0465), 0.6666666666666666, 0.6923076923076923)\n",
      "=====> Optimized weights: tensor([ 0.6307, -1.9531, -1.9767, -1.7830,  1.3874, -1.8497,  1.7020,  1.0921,\n",
      "         1.4277, -1.9367,  0.0450,  0.6233, -1.4766,  1.7222, -1.9676, -0.6203,\n",
      "        -1.9088,  1.7169,  1.6781,  1.4247, -0.3855, -0.5880,  1.6849,  1.0543])\n",
      "=====> init acc: (tensor(nan), 0.75, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.5451), 0.8333333333333334, 0.8571428571428571)\n",
      "=====> Optimized weights: tensor([ 0.8772,  1.3577,  0.7605, -0.2827, -0.1820, -1.8485, -0.0321,  0.8006,\n",
      "         0.0860,  0.8800,  0.7550,  0.3769,  1.4935, -1.5232, -0.0708, -1.7465,\n",
      "        -0.1568, -1.3904,  0.7896,  1.3562, -0.9588,  1.3284,  0.8085,  0.8384])\n",
      "=====> init acc: (tensor(nan), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3958), 0.75, 0.8)\n",
      "=====> Optimized weights: tensor([ 0.0841, -1.6775,  0.5786,  0.2461,  1.6702,  1.0940, -0.7632, -0.7641,\n",
      "         1.2214,  0.5810,  1.3190,  1.1560, -1.5721, -1.7947, -0.8175,  1.0694,\n",
      "        -1.9396, -0.6512,  1.2683,  0.9629,  1.1848,  0.8801,  0.6019, -0.5581])\n",
      "=====> init acc: (tensor(nan), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.5128), 0.9166666666666666, 0.8888888888888888)\n",
      "=====> Optimized weights: tensor([ 0.4137, -0.1272,  0.4279, -0.8173,  1.6322,  1.0430,  0.0977, -1.2779,\n",
      "         1.7491,  0.5504,  0.8649,  1.2540,  0.4930, -1.9466, -0.3620,  0.6653,\n",
      "         1.1069,  1.7500,  1.5446,  1.5566,  1.7282,  1.6434,  0.2918, -1.3032])\n",
      "=====> init acc: (tensor(nan), 0.8333333333333334, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.3559), 0.8333333333333334, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([-1.4793,  1.2486,  0.6097,  0.5155, -0.0093,  1.6658, -0.8149, -0.3419,\n",
      "         1.5111,  1.2263,  0.5375, -1.7744, -1.8113, -1.7983, -0.8911,  1.2952,\n",
      "         1.2233, -1.2682,  0.0000,  0.4094, -1.9282,  1.2151,  1.1154, -0.2630])\n",
      "=====> init acc: (tensor(nan), 0.75, 0.7916666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.4858), 1.0, 0.8235294117647058)\n",
      "=====> Optimized weights: tensor([ 0.6882, -1.9372,  0.3534,  1.0488,  1.8056,  1.6187,  1.2215,  0.3101,\n",
      "         0.0222,  0.8403, -0.6288,  1.8105, -1.1496,  0.4579,  0.8087,  1.4564,\n",
      "        -1.2069, -0.1766, -0.8853,  1.5683, -1.0994,  1.2856,  0.7784,  0.4975])\n",
      "=====> init acc: (tensor(nan), 0.5833333333333334, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.6164), 0.9166666666666666, 0.8666666666666667)\n",
      "=====> Optimized weights: tensor([ 0.7167,  1.0443,  0.3233, -1.2400,  0.7086, -1.9386,  0.6220, -0.0958,\n",
      "         1.6534, -1.4777,  0.4745,  1.3542, -1.0891,  0.9791,  1.6842,  0.9437,\n",
      "         0.9637, -0.2292, -1.7602,  0.4271,  1.2914,  0.6918, -0.1367, -1.9413])\n",
      "=====> init acc: (tensor(nan), 0.8333333333333334, 0.7916666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.6031), 1.0, 1.0)\n",
      "=====> Optimized weights: tensor([ 0.6504,  1.8699, -1.9812,  1.3835,  0.8006,  0.0534, -0.3821,  0.5355,\n",
      "         1.7287, -1.2172,  0.7925,  0.0346,  1.6199,  1.6242, -1.9500,  1.7445,\n",
      "        -1.8938,  0.1655, -1.7913,  1.6345, -1.9377, -1.1300,  0.8347, -1.7977])\n",
      "=====> init acc: (tensor(nan), 0.75, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> Optimized acc: (tensor(0.2006), 0.75, 0.75)\n",
      "=====> Optimized weights: tensor([-0.4585, -1.9191,  0.9430, -1.9454, -0.0385, -0.4179,  1.3460,  1.2459,\n",
      "        -1.9230, -1.9406,  1.8682, -1.9225,  1.5278,  1.3634,  1.2632,  0.3215,\n",
      "         0.5840,  1.5804, -0.0697, -1.4654,  0.1646, -1.9250, -1.3323,  0.2602])\n",
      "=====> init acc: (tensor(nan), 0.5833333333333334, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])\n",
      "=====> Optimized acc: (tensor(0.5598), 0.9166666666666666, 0.8666666666666667)\n",
      "=====> Optimized weights: tensor([-0.2756,  1.1439, -1.7948,  1.7451,  0.5366,  1.6178, -1.1882,  1.5210,\n",
      "         0.9486,  0.2453,  1.1135, -0.7002, -1.8670,  0.1424,  1.3091, -1.4355,\n",
      "         1.3393, -1.9204,  1.8096, -1.8627, -0.9393,  1.5006,  1.0894,  1.0675])\n"
     ]
    }
   ],
   "source": [
    "Evaluate(DVA, max_epochs=1, n_proc=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.6666666666666666, 0.625)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/hadoop/.conda/envs/torch_B/lib/python3.6/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='none' instead.\n",
      "  warnings.warn(warning.format(ret))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot   0 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.09071314/0.6900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.06570292/0.6900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.02751112/0.7300000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.03293490/0.6900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.03492725/0.6900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.01694691/0.6900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.99815124/0.7200000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.00041151/0.7200000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 1.00433934/0.7200000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.99595571/0.7300000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.97998434/0.7400000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.96897393/0.7400000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.96670741/0.7300000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.96261752/0.7300000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.95409602/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.94572860/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.94138533/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.93667138/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.92869949/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.92032516/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.91451335/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.90913290/0.7400000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.90255141/0.7400000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.89579874/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.89077973/0.7600000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.88604140/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.88001895/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.87432879/0.7600000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.86937308/0.7400000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.86425710/0.7500000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.85901827/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.85443532/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.85030138/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.84570229/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.84128594/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.83739710/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.83352554/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.82971275/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.82623434/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.82295942/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.81949455/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.81638944/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.81417036/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.81207919/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.81062424/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.80940896/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.80792671/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.80654311/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.80533355/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.80373949/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.80174553/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.79989564/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.79822344/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.79632109/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.79450506/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.79270554/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.79075640/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.78931963/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.78785402/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.78598845/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.78413361/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.78267723/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.78127444/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.78034019/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77928162/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77779359/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77659273/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77562541/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77443552/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77372772/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77291572/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77180201/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77123034/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.77071840/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76988959/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76939613/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76884454/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76866603/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76853132/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76793230/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76734519/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76695365/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76655227/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76602966/0.7700000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76513666/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76430190/0.7800000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76330423/0.8000000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76230919/0.8000000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76131088/0.8000000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.76021230/0.8100000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75908571/0.8000000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75833410/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75763583/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75700563/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75653666/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75628030/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75609368/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75589156/0.7900000\n",
      "####Few Shot   0 | 790 ####, loss/acc = 0.75571775/0.7900000\n",
      "=====> Optimized acc: (tensor(0.1094, device='cuda:1'), 0.8333333333333334, 0.8181818181818182)\n",
      "=====> Optimized weights: tensor([-20.8558,   2.3633,   0.1991,  10.2077,   1.8304,  -6.6004,  11.2558,\n",
      "        -23.1445, -17.9397, -18.3636, -15.6159,  -8.2265,   0.5333,   1.1800,\n",
      "         -6.3014,   4.1482,  -7.9859,   3.9461, -21.7642, -12.0827,  -9.7620,\n",
      "          4.5101, -21.7820,   1.7767], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.8333333333333334, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.09656811/0.7000000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.06446207/0.7100000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.02850330/0.7000000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.03771758/0.6800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.03356218/0.6800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.01666129/0.6900000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.00992596/0.7100000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.00838208/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 1.00059736/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.99375540/0.6900000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.98971540/0.6800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.98302770/0.6900000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.97340178/0.7000000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.96479368/0.7100000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.95736581/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.94929999/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.94406480/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.93826956/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.92974746/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.92227256/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.91654283/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.91037345/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.90399671/0.7300000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot  24 | 790 ####, loss/acc = 0.89902794/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.89576012/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.89149916/0.7100000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.88684905/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.88282531/0.7400000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.87852180/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.87470114/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.87311989/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.86952180/0.7200000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.86770922/0.7100000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.86681849/0.7100000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.86472350/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.86241919/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.85986102/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.85659850/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.85356277/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.85065442/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.84912610/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.84516990/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.84232599/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83922243/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83593118/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83449906/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83291352/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83146113/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83275163/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83253992/0.7400000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82952887/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83209682/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83497512/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.83216441/0.7300000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82868898/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82960975/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82877904/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82812762/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82782942/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82741135/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82705522/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82780439/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82770938/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82705057/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82695752/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82729477/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82668006/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82623321/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82574731/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82472366/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82482207/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82367086/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82438332/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82423383/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82388794/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82397139/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82486826/0.7500000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82469612/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82378888/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82321227/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82309973/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82174373/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.82042962/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81938761/0.7800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81854367/0.7800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81787306/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81677580/0.7800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81618834/0.7800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81582040/0.7800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81578612/0.7800000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81544608/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81556183/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81547046/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81507659/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81473547/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81528556/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81492609/0.7700000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81405526/0.7600000\n",
      "####Few Shot  24 | 790 ####, loss/acc = 0.81370020/0.7600000\n",
      "=====> Optimized acc: (tensor(-0.1880, device='cuda:1'), 0.75, 1.0)\n",
      "=====> Optimized weights: tensor([-16.0806,   0.6171,  -9.1645,  -9.1317,   0.1462,  -9.0886,  -7.4658,\n",
      "         -7.6530, -10.8180, -11.6876,   6.3336,   0.8750,   2.0671,  -1.5532,\n",
      "         -0.7920,   0.7835,  -5.3775,  -3.3304,  -1.5482,  -0.8294,  -0.5800,\n",
      "         -2.8531,  -5.2104,  -0.0273], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.5833333333333334, 0.5416666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.05828762/0.6900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.04265058/0.7000000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.02900922/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.02178240/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.01180637/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 1.00016856/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.99135751/0.7100000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.98331571/0.7100000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.97412074/0.7100000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.96500593/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.95724154/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.94945645/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.94053751/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.93091029/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.92152405/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.91310799/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.90497899/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.89761919/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.89052999/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.88331115/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.87608266/0.7200000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.86950564/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.86316973/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.85683531/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.85052371/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.84430212/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.83891708/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.83399069/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.82967532/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.82585877/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.82195544/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.81861901/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.81568611/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.81237763/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.80938703/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.80665761/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.80371112/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.80099398/0.7300000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.79838210/0.7400000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.79586875/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.79326868/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.79070383/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.78818929/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.78586090/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.78370392/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.78146207/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.77929616/0.7600000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.77743727/0.7600000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot  48 | 790 ####, loss/acc = 0.77602994/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.77412438/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.77215463/0.7600000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.77047694/0.7600000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.76897568/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.76746911/0.7500000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.76600397/0.7600000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.76466072/0.7600000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.76352942/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.76207209/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.76051021/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75929487/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75826383/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75717485/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75603712/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75508082/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75415701/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75304204/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75202888/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75117224/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.75028902/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74928713/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74859023/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74769855/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74698853/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74636889/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74581891/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74510270/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74398696/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74282968/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74176520/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.74074805/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.73941833/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.73793715/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.73662341/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.73547971/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.73421460/0.7800000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.73251313/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.73054117/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72888374/0.7700000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72764641/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72640276/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72524053/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72453344/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72409004/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72356969/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72303343/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72273374/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72275305/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72258544/0.7900000\n",
      "####Few Shot  48 | 790 ####, loss/acc = 0.72225618/0.7900000\n",
      "=====> Optimized acc: (tensor(0.7511, device='cuda:1'), 0.75, 0.75)\n",
      "=====> Optimized weights: tensor([  1.4509,  -5.7906, -10.6229,  -1.5592,  12.8247,   8.3550,  -5.0461,\n",
      "         -8.9355, -22.6981, -21.6493,   1.4721,  -9.5522,   6.6309,   1.0803,\n",
      "         10.8328,   1.9581,   1.7001, -20.6427,   1.7839,  -2.2961,  12.5974,\n",
      "         -0.2670,   4.9175, -22.5605], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.8333333333333334, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.07085562/0.7000000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.06342494/0.6900000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.04763329/0.7000000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.03839874/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.03545690/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.02938020/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.02309859/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.02038527/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.01671576/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.01109910/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.00491643/0.7100000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 1.00156927/0.7100000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.99905276/0.6900000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.99512827/0.7100000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.99203026/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.99021876/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.98776352/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.98492020/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.98283339/0.7100000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.98088789/0.7100000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.97908485/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.97775358/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.97586769/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.97373718/0.7100000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.97196311/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.97050852/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96884751/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96730918/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96610320/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96528989/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96466184/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96423209/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96378404/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96340805/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96250826/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96157408/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.96068984/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.95993370/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.95949548/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.95918959/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.95820594/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.95686942/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.95531046/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.95380288/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.95194823/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94960099/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94719881/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94557518/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94423312/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94394088/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94328970/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94208664/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94109154/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.94028336/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93926585/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93851668/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93786806/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93656355/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93512428/0.7500000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93401587/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93302155/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93223739/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93134999/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.93007803/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92910188/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92832130/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92753470/0.7200000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92700464/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92619997/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92521638/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92455232/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92393804/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92354929/0.7300000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot  72 | 790 ####, loss/acc = 0.92298365/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92223930/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92167908/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92117763/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92062807/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.92023450/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91953367/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91904104/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91856140/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91843802/0.7300000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91778457/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91718137/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91682160/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91637766/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91602683/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91605049/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91576815/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91509497/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91468424/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91438180/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91407418/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91388583/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91388971/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91358405/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91300237/0.7400000\n",
      "####Few Shot  72 | 790 ####, loss/acc = 0.91263300/0.7400000\n",
      "=====> Optimized acc: (tensor(0.0367, device='cuda:1'), 0.9166666666666666, 0.8888888888888888)\n",
      "=====> Optimized weights: tensor([-16.1919, -12.6318, -15.2320, -15.5190,   2.4423, -14.8917,   3.5392,\n",
      "         12.3353,  -0.0449,  -2.1438,   1.4150,   5.3193, -10.2301,  13.2087,\n",
      "        -14.4355,   7.7050, -17.7734,  -0.3407, -22.9781,   6.2619,  -4.7401,\n",
      "          0.5500, -18.2087,  -4.7354], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.6666666666666666, 0.7916666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.07916760/0.6900000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.07338977/0.6900000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.05469787/0.7000000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.04554069/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.04431796/0.7000000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.03910077/0.7000000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.03244030/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.03080857/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.02949727/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.02490735/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.01922274/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.01647365/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.01483929/0.7000000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.01190341/0.7000000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.00902033/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.00877905/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.00816488/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.00536954/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.00190771/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 1.00026858/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.99897087/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.99719423/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.99568588/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.99560732/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.99500352/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.99285102/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.99047637/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98917365/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98794311/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98687500/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98659164/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98566216/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98380065/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98226005/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98125857/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98036695/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.98013747/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97933954/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97770828/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97645211/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97551209/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97484255/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97449630/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97334421/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97190779/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97100073/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.97023970/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96992636/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96935439/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96816605/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96707922/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96631128/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96587473/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96530724/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96445596/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96384221/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96341842/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96305466/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96249199/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96213639/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96199870/0.7500000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96247542/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96275032/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96270126/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96330070/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96453637/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96554786/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96642286/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96772212/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96805745/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96734941/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96692932/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96663392/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96675646/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96753383/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96717000/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96576369/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96496880/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96444595/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96416366/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96426499/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96340483/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96196771/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96112996/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96053839/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.96045202/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95955938/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95815194/0.7100000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95739263/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95687681/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95678961/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95601827/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95484221/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95414865/0.7200000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95366693/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95375234/0.7300000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95314950/0.7300000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot  96 | 790 ####, loss/acc = 0.95200831/0.7400000\n",
      "####Few Shot  96 | 790 ####, loss/acc = 0.95149797/0.7200000\n",
      "=====> Optimized acc: (tensor(0.0596, device='cuda:1'), 0.9166666666666666, 0.9)\n",
      "=====> Optimized weights: tensor([-13.4710,  -1.8039, -19.5646, -21.9484, -13.1600,  14.4573,  -5.9486,\n",
      "        -10.9920,  -1.1341, -20.3734, -15.9459,   4.3373,   0.3890, -16.4825,\n",
      "         13.6326, -24.9049,   1.2090,   0.3815,   0.6620,   1.9427,  -2.5008,\n",
      "        -16.8482,  18.3027,   1.5537], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.9166666666666666, 0.875)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.09625566/0.6900000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.08268690/0.6900000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.05758989/0.7000000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.04819095/0.7000000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.05052018/0.7000000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.04749501/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.04377162/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.04444981/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.04347885/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.04087114/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.04063261/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.04036474/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.03808606/0.7000000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.03578150/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.03499615/0.7000000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.03309560/0.7000000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.03038800/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.02853441/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.02759552/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.02560675/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.02355719/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.02212584/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.02030230/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.01940668/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.01834309/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.01641941/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.01555586/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.01449275/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.01235723/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.01108909/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.01019049/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.00792766/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.00555408/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.00384212/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.00199020/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 1.00031364/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.99823016/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.99614060/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.99415368/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.99259138/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.99081773/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.98887336/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.98727638/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.98595816/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.98450017/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.98291993/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.98170507/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.98078477/0.7000000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97975457/0.7000000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97861981/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97784448/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97746503/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97667348/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97579646/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97509217/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97458911/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97382665/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97281599/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97202897/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97165942/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.97087187/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96995455/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96927279/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96879965/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96815348/0.7100000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96725816/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96661997/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96617538/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96549779/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96449310/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96374875/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96325648/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96246856/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96160090/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96093673/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.96063620/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95986372/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95893699/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95828092/0.7200000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95769763/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95712066/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95613265/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95517164/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95435965/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95366347/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95266080/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95175135/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95097613/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.95034182/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94947737/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94864011/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94805145/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94769758/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94698280/0.7400000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94631058/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94565576/0.7300000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94508386/0.7400000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94432431/0.7400000\n",
      "####Few Shot 120 | 790 ####, loss/acc = 0.94337463/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.7172, device='cuda:1'), 0.9166666666666666, 1.0)\n",
      "=====> Optimized weights: tensor([ -6.9286,   0.6896,   2.8559, -25.3031, -11.3314, -13.3945,  -0.1608,\n",
      "          1.0053,  -8.4329, -19.2635,  -4.3620,  -3.1091,   0.9554, -15.4453,\n",
      "        -22.3956, -19.1770,  -0.5925,  -5.5674,  -2.3077,   1.9229,   1.5752,\n",
      "        -13.2002, -22.8728,  -2.3030], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.6666666666666666, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.05599034/0.7100000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.05070710/0.7100000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.04354608/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.03846300/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.03498387/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.03040123/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.02583206/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.02291942/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.02016175/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.01691437/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.01406777/0.7400000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 144 | 790 ####, loss/acc = 1.01210272/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.00983882/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.00722265/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.00499964/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.00329828/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.00166523/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 1.00021887/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.99914336/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.99773413/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.99597681/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.99425936/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.99271494/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.99109948/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.98963714/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.98827189/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.98667306/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.98480904/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.98310989/0.7200000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.98164773/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.98019034/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.97877532/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.97747374/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.97612017/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.97465140/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.97321069/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.97184974/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.97049421/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.96914482/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.96787095/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.96653819/0.7300000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.96510065/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.96365321/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.96226090/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.96085197/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.95944053/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.95807928/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.95671082/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.95525515/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.95381266/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.95244199/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.95113790/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.94985288/0.7600000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.94855011/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.94725645/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.94594109/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.94464356/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.94333237/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.94199109/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.94067991/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.93941009/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.93813705/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.93684745/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.93555754/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.93429345/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.93306434/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.93184721/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.93068212/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92954206/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92840338/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92724901/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92613024/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92506409/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92404264/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92304248/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92204547/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92103767/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.92002517/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91902685/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91804183/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91704750/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91603255/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91500628/0.7500000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91397882/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91296715/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91199327/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91106558/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.91019231/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90932876/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90845281/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90759176/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90678251/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90598607/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90515214/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90430832/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90345436/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90262008/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90179682/0.7400000\n",
      "####Few Shot 144 | 790 ####, loss/acc = 0.90099531/0.7400000\n",
      "=====> Optimized acc: (tensor(-0.4989, device='cuda:1'), 0.6666666666666666, 0.6666666666666666)\n",
      "=====> Optimized weights: tensor([-15.9836,  -0.7263,   1.9245, -26.0168, -15.4860,  -1.0266,   1.0405,\n",
      "        -17.0708, -22.0831,  -4.3602, -17.4361,  18.7753,   4.2364, -20.6055,\n",
      "          1.2939, -18.2290, -14.8858, -13.6300, -20.4431, -20.9774, -17.7048,\n",
      "         -0.6224,   6.4906, -16.2941], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.75, 0.7083333333333334)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.05848992/0.7100000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.05669856/0.7100000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.05396771/0.7100000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.05100298/0.7100000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.04848838/0.7000000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.04605365/0.7100000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.04333127/0.7100000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.04046202/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.03769326/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.03515053/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.03264463/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.03003204/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.02738667/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.02480841/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.02227473/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.01986432/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.01753390/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.01538253/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.01340497/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.01141667/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.00940132/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.00734067/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.00534010/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.00354767/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.00181890/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 1.00013256/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.99857002/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.99709433/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.99561483/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.99409628/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.99261510/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.99121821/0.7200000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.98984498/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.98849791/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.98722070/0.7400000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 168 | 790 ####, loss/acc = 0.98597276/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.98467100/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.98338950/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.98209643/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.98078978/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.97947341/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.97813016/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.97671998/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.97523916/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.97377181/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.97235894/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.97089571/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.96947390/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.96811110/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.96674818/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.96546388/0.7400000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.96432060/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.96316016/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.96194386/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.96077895/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95970672/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95866823/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95764458/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95661271/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95566183/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95476270/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95383883/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95292580/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95211494/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95136720/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.95061493/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94988000/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94927353/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94869202/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94812495/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94761360/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94711655/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94661403/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94615763/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94570327/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94523734/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94478226/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94430470/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94384629/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94335574/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94286883/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94228435/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94162679/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94091117/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.94021255/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93950725/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93878824/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93812752/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93748283/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93683207/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93622506/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93566900/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93513006/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93461120/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93410057/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93356729/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93301034/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93247151/0.7300000\n",
      "####Few Shot 168 | 790 ####, loss/acc = 0.93200225/0.7300000\n",
      "=====> Optimized acc: (tensor(-0.4572, device='cuda:1'), 0.5833333333333334, 0.625)\n",
      "=====> Optimized weights: tensor([ -4.7472, -21.4852,  -3.8981,  -2.1207,   7.8477,   6.2072, -19.7247,\n",
      "         -7.2170,  13.4755, -14.3083, -16.0694, -11.5291,  13.2921, -18.1232,\n",
      "          2.8892,   0.9364, -23.4108, -23.6742, -25.3091,  16.7939, -24.3380,\n",
      "        -10.0621,  12.6807, -15.8623], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.8333333333333334, 0.875)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.08287430/0.6900000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.07140708/0.6900000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.04702711/0.7100000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.04706490/0.6800000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.05158186/0.6900000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.04287028/0.6800000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.03035498/0.7100000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.02752995/0.7300000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.02830076/0.7200000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.02325654/0.7300000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.01444900/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.00834095/0.7000000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.00610626/0.6900000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 1.00247967/0.6900000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.99687093/0.7000000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.99255556/0.7300000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.98990762/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.98596662/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.98101836/0.7100000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.97728449/0.7100000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.97367346/0.7000000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.96921629/0.7100000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.96519262/0.7300000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.96252370/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.95918107/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.95478410/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.95053118/0.7300000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.94703847/0.7400000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.94329989/0.7400000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.93976092/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.93653262/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.93281037/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.92868179/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.92502975/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.92169434/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.91882354/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.91608202/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.91287386/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.90959054/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.90637589/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.90334612/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.90025300/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.89651930/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.89246964/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.88840926/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.88456804/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.88105655/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.87758237/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.87442756/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.87210035/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.87041533/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.86893797/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.86771280/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.86695480/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.86656892/0.7700000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.86530232/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.86374289/0.7400000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.86190110/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.85967690/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.85733283/0.7500000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 192 | 790 ####, loss/acc = 0.85452849/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.85216194/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.85040170/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84897786/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84772569/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84707838/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84699005/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84681708/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84707505/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84746081/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84784317/0.7500000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84774315/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84736907/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84675187/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84607881/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84594846/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84572387/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84574753/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84574074/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84599417/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84641230/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84698206/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84691763/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84688890/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84683144/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84663063/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84658384/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84607637/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84540665/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84513479/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84503192/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84489435/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84424406/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84332716/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84208030/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.84045607/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.83855742/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.83676428/0.7600000\n",
      "####Few Shot 192 | 790 ####, loss/acc = 0.83502775/0.7700000\n",
      "=====> Optimized acc: (tensor(-0.4364, device='cuda:1'), 0.9166666666666666, 0.8333333333333334)\n",
      "=====> Optimized weights: tensor([ -8.8103,   2.6036, -24.5593,  -0.0852,   5.4244, -17.3575,   2.4042,\n",
      "         -4.6498,  13.1001, -11.1361, -24.2109,  -0.9320,  -5.2166,  -8.8340,\n",
      "         -0.3020,   2.7476, -23.7116, -13.9412,   9.3008, -18.3319, -23.2569,\n",
      "        -18.4843,  -9.0964, -21.4461], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.6666666666666666, 0.75)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.05212235/0.7100000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.04636705/0.7100000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.04152620/0.7000000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.03573394/0.7000000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.02941847/0.7200000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.02356076/0.7300000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.01836538/0.7300000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.01315093/0.7300000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.00773776/0.7300000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 1.00233519/0.7300000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.99703962/0.7100000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.99192804/0.7100000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.98702055/0.7200000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.98221010/0.7300000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.97756732/0.7400000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.97305924/0.7400000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.96866280/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.96441668/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.96032488/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.95629698/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.95243591/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.94866097/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.94485122/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.94113970/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.93751234/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.93393737/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.93036973/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.92684329/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.92338026/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.92001700/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.91676515/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.91365212/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.91055387/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.90747660/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.90441406/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.90136874/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.89834726/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.89537585/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.89247876/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.88962561/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.88682193/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.88398743/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.88119477/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.87849462/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.87583107/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.87322015/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.87067831/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.86816359/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.86567765/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.86331558/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.86097819/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.85866964/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.85639107/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.85410041/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.85189772/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.84972948/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.84754860/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.84539598/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.84330744/0.7600000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.84124392/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.83919609/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.83715147/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.83512992/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.83314216/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.83119714/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.82927781/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.82735246/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.82544082/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.82345146/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.82144958/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.81943983/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.81744063/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.81545067/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.81347466/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.81152636/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.80963492/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.80776870/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.80593199/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.80412024/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.80233496/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.80057406/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.79889512/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.79722059/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.79556733/0.7900000\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "####Few Shot 216 | 790 ####, loss/acc = 0.79399484/0.7900000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.79252845/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.79112506/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.78973109/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.78836668/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.78704923/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.78574908/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.78441131/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.78307062/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.78175950/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.78044146/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.77917081/0.7700000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.77794015/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.77678627/0.7800000\n",
      "####Few Shot 216 | 790 ####, loss/acc = 0.77554101/0.7800000\n",
      "=====> Optimized acc: (tensor(-0.1636, device='cuda:1'), 0.9166666666666666, 0.875)\n",
      "=====> Optimized weights: tensor([  6.3288,   2.3264,  -4.3382,   7.7447, -17.8090, -25.6485, -12.7062,\n",
      "        -26.7084, -13.8021, -25.4726, -22.7594,  11.4261,  -7.5592, -24.9427,\n",
      "          4.2897,   2.8525,  12.2014,   1.7820, -11.4837, -14.4374, -21.7325,\n",
      "        -22.2585,  -8.9989, -23.7101], device='cuda:1')\n",
      "=====> init acc: (tensor(nan, device='cuda:1'), 0.5833333333333334, 0.6666666666666666)\n",
      "=====> init weights: tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
      "       device='cuda:1')\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.06283081/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.06563556/0.7000000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.06288111/0.7000000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.05636060/0.7000000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.05372655/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.05220759/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.04851508/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.04400373/0.7100000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.04079866/0.7000000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.03804362/0.7000000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.03442979/0.7000000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.03044248/0.7100000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.02690721/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.02357304/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.01988399/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.01598895/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.01227736/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.00869691/0.7100000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.00502825/0.7100000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 1.00123584/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 0.99760735/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 0.99403936/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 0.99046624/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 0.98695701/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 0.98362273/0.7200000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 0.98036158/0.7100000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 0.97710997/0.7100000\n",
      "####Few Shot 240 | 790 ####, loss/acc = 0.97391266/0.7200000\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-25-d7d19d901c93>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mEvaluate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mDVA\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_epochs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_meta_steps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m100\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlr4weights\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m<ipython-input-23-28bab4d62ba1>\u001b[0m in \u001b[0;36mEvaluate\u001b[0;34m(self, max_epochs, max_meta_steps, lr4weights)\u001b[0m\n\u001b[1;32m     33\u001b[0m             \u001b[0;32mfor\u001b[0m \u001b[0mmeta_step\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmax_meta_steps\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     34\u001b[0m                 \u001b[0mweights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mto_var\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzeros\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbatch_size\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtmp_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 35\u001b[0;31m                 \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mComputeGrads4Weights\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mweights\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmp_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfew_shot_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     36\u001b[0m                 \u001b[0mgrad_weights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgrad_weights\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mgrad_weights\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     37\u001b[0m                 \u001b[0;31m# ==============Update process in Adam=======================\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/AllRumorDetection/PropagationRD/RumdetecFramework/InstanceReweighting.py\u001b[0m in \u001b[0;36mComputeGrads4Weights\u001b[0;34m(self, step, batch, weights, tmp_model, few_shot_data)\u001b[0m\n\u001b[1;32m    265\u001b[0m             print('####Expand Few Shot  %3d | %3d ####, loss/acc = %6.8f/%6.7f' % (\n\u001b[1;32m    266\u001b[0m                 \u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweak_set\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0me_loss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0me_acc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 267\u001b[0;31m             ))\n\u001b[0m\u001b[1;32m    268\u001b[0m             \u001b[0mloss\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mloss\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcoefff4expandset\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0me_loss\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    269\u001b[0m         grad_weights = torch.autograd.grad(loss, weights, only_inputs=True,\n",
      "\u001b[0;32m~/.conda/envs/torch_B/lib/python3.6/site-packages/torch/autograd/__init__.py\u001b[0m in \u001b[0;36mgrad\u001b[0;34m(outputs, inputs, grad_outputs, retain_graph, create_graph, only_inputs, allow_unused)\u001b[0m\n\u001b[1;32m    155\u001b[0m     return Variable._execution_engine.run_backward(\n\u001b[1;32m    156\u001b[0m         \u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mgrad_outputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mretain_graph\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcreate_graph\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 157\u001b[0;31m         inputs, allow_unused)\n\u001b[0m\u001b[1;32m    158\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    159\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "Evaluate(DVA, max_epochs=10, max_meta_steps=100, lr4weights=0.2)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
